From 977c71736d0b1b5edb5ee172abe70aad4e544465 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Thu, 24 Oct 2013 18:13:17 +0900 Subject: adding lock for race condition Change-Id: I24ecd1d2b54510bd8d57853996ed9296a46dfc9d Signed-off-by: kibak.yoon --- src/client.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client.cpp b/src/client.cpp index 952a919..759ab16 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -1586,9 +1586,11 @@ EXTAPI int sf_register_event(int handle , unsigned int event_type , event_condi memset(g_cb_table[i].call_back_key,'\0',MAX_KEY_LEN); snprintf(g_cb_table[i].call_back_key,(MAX_KEY_LEN-1),"%s%x",DEFAULT_SENSOR_KEY_PREFIX, event_type); + _lock.lock(); g_cb_table[i].cb_event_type = event_type; g_cb_table[i].client_data = cb_data; g_cb_table[i].sensor_callback_func_t = cb; + _lock.unlock(); switch (event_type ) { case ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME: -- cgit v1.2.3