提交 e987c0a1 编写于 作者: H HexToString

add lock and try

上级 7e380134
...@@ -69,15 +69,12 @@ DEFINE_bool(V, false, "print version, bool"); ...@@ -69,15 +69,12 @@ DEFINE_bool(V, false, "print version, bool");
DEFINE_bool(g, false, "user defined gflag path"); DEFINE_bool(g, false, "user defined gflag path");
DECLARE_string(flagfile); DECLARE_string(flagfile);
//
/*
namespace bthread { namespace bthread {
extern pthread_mutex_t g_task_control_mutex; extern pthread_mutex_t g_task_control_mutex;
} }
pthread_mutex_t g_worker_start_fn_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t g_worker_start_fn_mutex = PTHREAD_MUTEX_INITIALIZER;
*/
void pthread_worker_start_fn() { void pthread_worker_start_fn() {
/*
while (pthread_mutex_lock(&g_worker_start_fn_mutex) != 0) { while (pthread_mutex_lock(&g_worker_start_fn_mutex) != 0) {
} }
...@@ -86,18 +83,17 @@ void pthread_worker_start_fn() { ...@@ -86,18 +83,17 @@ void pthread_worker_start_fn() {
if (lock_status == EBUSY || lock_status == EAGAIN) { if (lock_status == EBUSY || lock_status == EAGAIN) {
pthread_mutex_unlock(&bthread::g_task_control_mutex); pthread_mutex_unlock(&bthread::g_task_control_mutex);
} }
*/
Resource::instance().thread_initialize(); Resource::instance().thread_initialize();
// Try to avoid deadlock in bthread // Try to avoid deadlock in bthread
/*
if (lock_status == EBUSY || lock_status == EAGAIN) { if (lock_status == EBUSY || lock_status == EAGAIN) {
while (pthread_mutex_lock(&bthread::g_task_control_mutex) != 0) { while (pthread_mutex_lock(&bthread::g_task_control_mutex) != 0) {
} }
} }
pthread_mutex_unlock(&g_worker_start_fn_mutex); pthread_mutex_unlock(&g_worker_start_fn_mutex);
*/
} }
static void g_change_server_port() { static void g_change_server_port() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册