summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaekyun Lee <jkyun.lee@samsung.com>2013-04-18 15:10:46 +0900
committerJaekyun Lee <jkyun.lee@samsung.com>2013-04-18 17:28:56 +0900
commit4b1b22ebcfc332db79982297e16a3dd56e0ae4de (patch)
treeeb8588f8dfbe70212a8acf6c545826c7f6b34b07
parent8267a80c257afe8805e8365200089518e96359c7 (diff)
downloadnfc-manager-neard-4b1b22ebcfc332db79982297e16a3dd56e0ae4de.tar.gz
nfc-manager-neard-4b1b22ebcfc332db79982297e16a3dd56e0ae4de.tar.bz2
nfc-manager-neard-4b1b22ebcfc332db79982297e16a3dd56e0ae4de.zip
Avoid Thread race condition
Change-Id: I5c4be24751c968b012474d3dce3433d3f30f5454
-rwxr-xr-xsrc/clientlib/net_nfc_client_ipc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/clientlib/net_nfc_client_ipc.c b/src/clientlib/net_nfc_client_ipc.c
index 2ba7f3b..79be676 100755
--- a/src/clientlib/net_nfc_client_ipc.c
+++ b/src/clientlib/net_nfc_client_ipc.c
@@ -441,7 +441,6 @@ static void *net_nfc_client_ipc_thread(void *data)
msg = net_nfc_client_read_response_msg(&result);
- pthread_mutex_lock(&cb_lock);
if (msg != NULL && msg->detail_message != NULL)
{
/* TODO : need to remove */
@@ -461,6 +460,7 @@ static void *net_nfc_client_ipc_thread(void *data)
}
else
{
+ pthread_mutex_lock(&cb_lock);
#ifdef USE_GLIB_MAIN_LOOP
net_nfc_client_call_dispatcher_in_g_main_loop(client_cb, msg);
#elif USE_ECORE_MAIN_LOOP
@@ -468,6 +468,7 @@ static void *net_nfc_client_ipc_thread(void *data)
#else
net_nfc_client_call_dispatcher_in_current_context(client_cb, msg);
#endif
+ pthread_mutex_unlock(&cb_lock);
}
}
else
@@ -482,7 +483,6 @@ static void *net_nfc_client_ipc_thread(void *data)
}
DEBUG_ERR_MSG("cannot read response msg");
}
- pthread_mutex_unlock(&cb_lock);
}
}