From e987c0a1a3c9bc7060f664b1b5ec273c156de82e Mon Sep 17 00:00:00 2001 From: HexToString <506181616@qq.com> Date: Mon, 5 Jul 2021 07:06:39 +0000 Subject: [PATCH] add lock and try --- core/predictor/src/pdserving.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core/predictor/src/pdserving.cpp b/core/predictor/src/pdserving.cpp index f637e8a9..d489e19b 100644 --- a/core/predictor/src/pdserving.cpp +++ b/core/predictor/src/pdserving.cpp @@ -69,15 +69,12 @@ DEFINE_bool(V, false, "print version, bool"); DEFINE_bool(g, false, "user defined gflag path"); DECLARE_string(flagfile); -// -/* namespace bthread { extern pthread_mutex_t g_task_control_mutex; } pthread_mutex_t g_worker_start_fn_mutex = PTHREAD_MUTEX_INITIALIZER; -*/ + void pthread_worker_start_fn() { - /* while (pthread_mutex_lock(&g_worker_start_fn_mutex) != 0) { } @@ -86,18 +83,17 @@ void pthread_worker_start_fn() { if (lock_status == EBUSY || lock_status == EAGAIN) { pthread_mutex_unlock(&bthread::g_task_control_mutex); } - */ + Resource::instance().thread_initialize(); // Try to avoid deadlock in bthread - /* + if (lock_status == EBUSY || lock_status == EAGAIN) { while (pthread_mutex_lock(&bthread::g_task_control_mutex) != 0) { } } pthread_mutex_unlock(&g_worker_start_fn_mutex); - */ } static void g_change_server_port() { -- GitLab