From 16a8f5914730ab22a2968d771c3cfe6a828b34e8 Mon Sep 17 00:00:00 2001 From: wangguibao Date: Tue, 23 Apr 2019 22:38:28 +0800 Subject: [PATCH] Fix dead-lock condition with PaddlePaddle GPU Predictor --- predictor/src/pdserving.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/predictor/src/pdserving.cpp b/predictor/src/pdserving.cpp index b24b8795..20e32a99 100644 --- a/predictor/src/pdserving.cpp +++ b/predictor/src/pdserving.cpp @@ -69,7 +69,15 @@ DEFINE_bool(V, false, "print version, bool"); DEFINE_bool(g, false, "user defined gflag path"); DECLARE_string(flagfile); -void pthread_worker_start_fn() { Resource::instance().thread_initialize(); } +namespace bthread { +extern pthread_mutex_t g_task_control_mutex; +} + +void pthread_worker_start_fn() { + while (pthread_mutex_lock(&bthread::g_task_control_mutex) != 0) {} + Resource::instance().thread_initialize(); + pthread_mutex_unlock(&bthread::g_task_control_mutex); +} static void g_change_server_port() { InferServiceConf conf; -- GitLab