From 5f7ecc6739d32f9cd195052ca0da14e9bc639276 Mon Sep 17 00:00:00 2001 From: cheoleun moon Date: Fri, 25 Jan 2019 04:36:37 +0000 Subject: [PATCH] Revert "Use mutex_lock to access g_dp_event_thread_id" This reverts commit 61cb40dc5fdc6cc22dd6a200ce2333f43d3a836a. Change-Id: If09f0ab1f6b81b07a72824c2526f45fae84338a5 --- provider-interface/download-provider-interface.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/provider-interface/download-provider-interface.c b/provider-interface/download-provider-interface.c index 8cacf66..401e3a8 100755 --- a/provider-interface/download-provider-interface.c +++ b/provider-interface/download-provider-interface.c @@ -299,8 +299,8 @@ static void *__dp_event_manager(void *arg) g_dp_client->notify = open(notify_fifo, O_RDONLY, 0600); if (g_dp_client->notify < 0) { TRACE_ERROR("[CRITICAL] failed to ESTABILISH IPC %s", notify_fifo); - CLIENT_MUTEX_LOCK(&g_function_mutex); g_dp_event_thread_id = 0; + CLIENT_MUTEX_LOCK(&g_function_mutex); __clear_interface(); CLIENT_MUTEX_UNLOCK(&g_function_mutex); return 0; @@ -311,16 +311,13 @@ static void *__dp_event_manager(void *arg) pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); while (g_dp_client != NULL && g_dp_client->notify >= 0) { - CLIENT_MUTEX_LOCK(&g_function_mutex); if (g_dp_event_thread_id <= 0 || pthread_self() != g_dp_event_thread_id) { TRACE_ERROR("competitive threads self:%lu global:%lu", pthread_self(), g_dp_event_thread_id); // another thread may work. just terminate - CLIENT_MUTEX_UNLOCK(&g_function_mutex); break; } - CLIENT_MUTEX_UNLOCK(&g_function_mutex); // blocking fifo. dp_ipc_event_fmt eventinfo; @@ -330,8 +327,8 @@ static void *__dp_event_manager(void *arg) (eventinfo.id <= 0 && eventinfo.errorcode == DP_ERROR_CLIENT_DOWN)) { TRACE_INFO("expelled by provider"); - CLIENT_MUTEX_LOCK(&g_function_mutex); g_dp_event_thread_id = 0; + CLIENT_MUTEX_LOCK(&g_function_mutex); __clear_interface(); CLIENT_MUTEX_UNLOCK(&g_function_mutex); return 0; @@ -367,9 +364,7 @@ static void *__dp_event_manager(void *arg) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); } // while - CLIENT_MUTEX_LOCK(&g_function_mutex); g_dp_event_thread_id = 0; // set 0 to not call pthread_cancel - CLIENT_MUTEX_UNLOCK(&g_function_mutex); TRACE_DEBUG("thread end by itself"); return 0; } -- 2.7.4