From 0626a4192a0b3e443c93db4755c2a2c3ce175648 Mon Sep 17 00:00:00 2001 From: Sangkoo Kim Date: Wed, 30 Mar 2016 13:32:52 +0900 Subject: [PATCH] Fix issue : fail to make thumbnail Change-Id: I1cd52a7288c98af44fcead2571e60d81d54c8cff Signed-off-by: Sangkoo Kim --- externals/MsgDevicedWrapper.cpp | 2 +- framework/storage-handler/MsgStorageMessage.cpp | 8 ++-- .../transaction-manager/MsgCmdHandlerStorage.cpp | 2 +- framework/transaction-manager/MsgTransManager.cpp | 44 +++++++++++----------- include/framework/MsgTransManager.h | 6 +-- include/proxy/MsgHandle.h | 2 +- include/proxy/MsgProxyListener.h | 4 +- include/utils/MsgMutex.h | 21 ++++++----- plugin/mms_plugin/MmsPluginConnManWrapper.cpp | 10 ++--- plugin/mms_plugin/MmsPluginUserAgent.cpp | 2 +- .../mms_plugin/include/MmsPluginConnManWrapper.h | 4 +- plugin/mms_plugin/include/MmsPluginHttp.h | 8 ++-- plugin/mms_plugin/include/MmsPluginUserAgent.h | 6 +-- .../sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp | 2 +- plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp | 4 +- plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp | 6 +-- plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp | 2 +- .../SmsCdmaPluginWapPushHandler.cpp | 6 +-- .../include/SmsCdmaPluginEventHandler.h | 4 +- .../sms_cdma_plugin/include/SmsCdmaPluginSetting.h | 4 +- .../include/SmsCdmaPluginTransport.h | 4 +- .../include/SmsCdmaPluginUAManager.h | 6 +-- plugin/sms_plugin/SmsPluginEventHandler.cpp | 2 +- plugin/sms_plugin/SmsPluginMain.cpp | 4 +- plugin/sms_plugin/SmsPluginSetting.cpp | 34 ++++++++--------- plugin/sms_plugin/SmsPluginSimMsg.cpp | 8 ++-- plugin/sms_plugin/SmsPluginTransport.cpp | 4 +- plugin/sms_plugin/SmsPluginWapPushHandler.cpp | 6 +-- plugin/sms_plugin/include/SmsPluginEventHandler.h | 4 +- plugin/sms_plugin/include/SmsPluginSatHandler.h | 4 +- plugin/sms_plugin/include/SmsPluginSetting.h | 4 +- plugin/sms_plugin/include/SmsPluginSimMsg.h | 4 +- plugin/sms_plugin/include/SmsPluginTransport.h | 4 +- plugin/sms_plugin/include/SmsPluginUAManager.h | 6 +-- proxy/MsgHandleControl.cpp | 2 +- proxy/MsgProxyListener.cpp | 38 +++++++++---------- utils/MsgSqliteWrapper.cpp | 6 +-- utils/MsgUtilFile.cpp | 15 +++++--- 38 files changed, 153 insertions(+), 149 deletions(-) diff --git a/externals/MsgDevicedWrapper.cpp b/externals/MsgDevicedWrapper.cpp index d43c957..d603b6e 100644 --- a/externals/MsgDevicedWrapper.cpp +++ b/externals/MsgDevicedWrapper.cpp @@ -25,7 +25,7 @@ #include "MsgDevicedWrapper.h" int g_lock_cnt = 0; -Mutex mx; +MsgMutex mx; void MsgDisplayLock() { diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index fd143b1..d7172e0 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -42,12 +42,12 @@ using namespace std; VARIABLES ==================================================================================================*/ -Mutex delNotiMx; -CndVar delNoticv; +MsgMutex delNotiMx; +MsgCndVar delNoticv; bool delNotiRunning = false; -Mutex delLogMx; -CndVar delLogcv; +MsgMutex delLogMx; +MsgCndVar delLogcv; bool delLogRunning = false; diff --git a/framework/transaction-manager/MsgCmdHandlerStorage.cpp b/framework/transaction-manager/MsgCmdHandlerStorage.cpp index cb6023a..ff617b7 100755 --- a/framework/transaction-manager/MsgCmdHandlerStorage.cpp +++ b/framework/transaction-manager/MsgCmdHandlerStorage.cpp @@ -34,7 +34,7 @@ FUNCTION IMPLEMENTATION ==================================================================================================*/ -Mutex mx; +MsgMutex mx; int g_job_cnt = 0; static gboolean __refresh_noti(void *data) diff --git a/framework/transaction-manager/MsgTransManager.cpp b/framework/transaction-manager/MsgTransManager.cpp index 3d1d70d..e49e9d8 100755 --- a/framework/transaction-manager/MsgTransManager.cpp +++ b/framework/transaction-manager/MsgTransManager.cpp @@ -259,7 +259,7 @@ void MsgTransactionManager::insertSentMsg(int reqId, MSG_PROXY_INFO_S* pPrxInfo) MSG_DEBUG("msg for submit: reqId %d listenerFd %d handleAddr %x", reqId, pPrxInfo->listenerFd, pPrxInfo->handleAddr); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); fd_map::iterator it = statusCBFdMap.find(pPrxInfo->listenerFd); @@ -286,7 +286,7 @@ MSG_PROXY_INFO_S* MsgTransactionManager::getProxyInfo(int reqId) void MsgTransactionManager::delProxyInfo(int reqId) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); sentmsg_map::iterator it = sentMsgMap.find(reqId); @@ -311,7 +311,7 @@ void MsgTransactionManager::workerEventQueue() mxQ.lock(); while (!eventQueue.front(&pCmd)) { /* if no item, wait */ MSG_DEBUG("waiting for task"); - cv.wait(mxQ.pMutex()); + cv.wait(mxQ.pMsgMutex()); } eventQueue.pop_front(); /* pop it from queue*/ mxQ.unlock(); @@ -448,7 +448,7 @@ void MsgTransactionManager::cleanup(int fd) { MSG_BEGIN(); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); servSock.close(fd); @@ -730,7 +730,7 @@ void MsgTransactionManager::setIncomingMsgCB(MSG_CMD_REG_INCOMING_MSG_CB_S *pCbI return; } - MutexLocker lock(mx); + MsgMutexLocker lock(mx); newmsg_list::iterator it = newMsgCBList.begin(); @@ -752,7 +752,7 @@ void MsgTransactionManager::setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB return; } - MutexLocker lock(mx); + MsgMutexLocker lock(mx); mmsconf_list::iterator it = newMMSConfMsgCBList.begin(); @@ -774,7 +774,7 @@ void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCb return; } - MutexLocker lock(mx); + MsgMutexLocker lock(mx); pushmsg_list::iterator it = newPushMsgCBList.begin(); @@ -796,7 +796,7 @@ void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo return; } - MutexLocker lock(mx); + MsgMutexLocker lock(mx); cbmsg_list::iterator it = newCBMsgCBList.begin(); @@ -827,7 +827,7 @@ void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S return; } - MutexLocker lock(mx); + MsgMutexLocker lock(mx); syncmlmsg_list::iterator it = newSyncMLMsgCBList.begin(); @@ -849,7 +849,7 @@ void MsgTransactionManager::setLBSMsgCB(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCbIn return; } - MutexLocker lock(mx); + MsgMutexLocker lock(mx); lbsmsg_list::iterator it = newLBSMsgCBList.begin(); @@ -891,7 +891,7 @@ void MsgTransactionManager::setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERA return; } - MutexLocker lock(mx); + MsgMutexLocker lock(mx); syncmlop_list::iterator it = operationSyncMLMsgCBList.begin(); @@ -911,7 +911,7 @@ void MsgTransactionManager::setStorageChangeCB(int listenerFd) if (listenerFd <= 0) THROW(MsgException::INVALID_PARAM, "InParam Error: listenerFd %d", listenerFd); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); storageChangeFdMap[listenerFd] = true; } @@ -922,7 +922,7 @@ void MsgTransactionManager::setReportMsgCB(int listenerFd) if (listenerFd <= 0) THROW(MsgException::INVALID_PARAM, "InParam Error: listenerFd %d", listenerFd); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); reportMsgCBFdMap[listenerFd] = true; } @@ -970,7 +970,7 @@ void MsgTransactionManager::broadcastIncomingMsgCB(const msg_error_t err, const MSG_DEBUG("valid %d dstport %d", msgInfo->msgPort.valid, msgInfo->msgPort.dstPort); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); newmsg_list::iterator it = newMsgCBList.begin(); @@ -1003,7 +1003,7 @@ void MsgTransactionManager::broadcastMMSConfCB(const msg_error_t err, const MSG_ int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); mmsconf_list::iterator it = newMMSConfMsgCBList.begin(); @@ -1036,7 +1036,7 @@ void MsgTransactionManager::broadcastPushMsgCB(const msg_error_t err, const MSG_ int eventSize = MsgMakeEvent(pushData, sizeof(MSG_PUSH_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); pushmsg_list::iterator it = newPushMsgCBList.begin(); @@ -1060,7 +1060,7 @@ void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB int eventSize = MsgMakeEvent(cbMsg, sizeof(MSG_CB_MSG_S), MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); cbmsg_list::iterator it = newCBMsgCBList.begin(); @@ -1093,7 +1093,7 @@ void MsgTransactionManager::broadcastSyncMLMsgCB(const msg_error_t err, const MS int eventSize = MsgMakeEvent(syncMLData, sizeof(MSG_SYNCML_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); syncmlmsg_list::iterator it = newSyncMLMsgCBList.begin(); @@ -1116,7 +1116,7 @@ void MsgTransactionManager::broadcastLBSMsgCB(const msg_error_t err, const MSG_L int eventSize = MsgMakeEvent(lbsData, sizeof(MSG_LBS_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); lbsmsg_list::iterator it = newLBSMsgCBList.begin(); @@ -1146,7 +1146,7 @@ void MsgTransactionManager::broadcastSyncMLMsgOperationCB(const msg_error_t err, int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_SYNCML_OPERATION, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); syncmlop_list::iterator it = operationSyncMLMsgCBList.begin(); @@ -1183,7 +1183,7 @@ void MsgTransactionManager::broadcastStorageChangeCB(const msg_error_t err, cons int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_STORAGE_CHANGE_IND, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); fd_map::iterator it = storageChangeFdMap.begin(); @@ -1220,7 +1220,7 @@ void MsgTransactionManager::broadcastReportMsgCB(const msg_error_t err, const ms int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND, err, (void**)(&pEventData)); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); fd_map::iterator it = reportMsgCBFdMap.begin(); diff --git a/include/framework/MsgTransManager.h b/include/framework/MsgTransManager.h index 2933099..38699a6 100755 --- a/include/framework/MsgTransManager.h +++ b/include/framework/MsgTransManager.h @@ -127,9 +127,9 @@ private: fd_map storageChangeFdMap; fd_map reportMsgCBFdMap; - Mutex mx; /* mutex for shared resources like callback listeners */ - Mutex mxQ; /* mutex for event queue */ - CndVar cv; + MsgMutex mx; /* mutex for shared resources like callback listeners */ + MsgMutex mxQ; /* mutex for event queue */ + MsgCndVar cv; MsgSimpleQ eventQueue; cynara *p_cynara; diff --git a/include/proxy/MsgHandle.h b/include/proxy/MsgHandle.h index edd472f..571e772 100755 --- a/include/proxy/MsgHandle.h +++ b/include/proxy/MsgHandle.h @@ -168,7 +168,7 @@ class MsgHandle char mCookie[MAX_COOKIE_LEN]; MsgIpcClientSocket mClientSock; - Mutex mx; + MsgMutex mx; }; #endif /* MSG_HANDLE_H */ diff --git a/include/proxy/MsgProxyListener.h b/include/proxy/MsgProxyListener.h index 3ae3ce0..f14a1f8 100755 --- a/include/proxy/MsgProxyListener.h +++ b/include/proxy/MsgProxyListener.h @@ -180,8 +180,8 @@ private: MsgIpcClientSocket cliSock; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; MsgSentStatusCBList sentStatusCBList; MsgNewMessageCBList newMessageCBList; diff --git a/include/utils/MsgMutex.h b/include/utils/MsgMutex.h index 43588da..89e3c56 100755 --- a/include/utils/MsgMutex.h +++ b/include/utils/MsgMutex.h @@ -30,17 +30,17 @@ using namespace std; int GetMsgReady(); void WaitMsgReady(int sec); -class Mutex +class MsgMutex { public: - Mutex() { + MsgMutex() { pthread_mutexattr_t mattr; pthread_mutexattr_init(&mattr); pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&m, &mattr); pthread_mutexattr_destroy(&mattr); } - ~Mutex() { pthread_mutex_destroy(&m); } + ~MsgMutex() { pthread_mutex_destroy(&m); } void lock() { pthread_mutex_lock(&m); } int timedlock() { @@ -51,32 +51,33 @@ public: } void unlock() { pthread_mutex_unlock(&m); } - pthread_mutex_t* pMutex() { return &m; } + pthread_mutex_t* pMsgMutex() { return &m; } private: pthread_mutex_t m; }; -class MutexLocker +class MsgMutexLocker { public: - MutexLocker(Mutex& mx) { + MsgMutexLocker(MsgMutex& mx) { pm = &mx; pm->lock(); } - ~MutexLocker() { + ~MsgMutexLocker() { pm->unlock(); } private: - Mutex *pm; + MsgMutex *pm; }; -class CndVar +class MsgCndVar { public: - CndVar() { pthread_cond_init(&c, 0); } + MsgCndVar() { pthread_cond_init(&c, 0); } + ~MsgCndVar() { pthread_cond_destroy(&c); } void wait(pthread_mutex_t* m) { pthread_cond_wait(&c, m); } int timedwait(pthread_mutex_t* m, int sec) { struct timeval now = {0}; diff --git a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp index 3428a09..ca073fc 100755 --- a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp +++ b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp @@ -25,8 +25,8 @@ #define MMS_CONTEXT_INVOKE_WAIT_TIME 30 #define MMS_CONNECTION_API_WAIT_TIME 420 -static Mutex g_mx; -static CndVar g_cv; +static MsgMutex g_mx; +static MsgCndVar g_cv; static connection_h g_connection = NULL; static connection_profile_h g_profile = NULL; @@ -374,7 +374,7 @@ void context_invoke(GSourceFunc func, void *ret) MSG_INFO("@@ WAIT @@"); - time_ret = g_cv.timedwait(g_mx.pMutex(), MMS_CONTEXT_INVOKE_WAIT_TIME); + time_ret = g_cv.timedwait(g_mx.pMsgMutex(), MMS_CONTEXT_INVOKE_WAIT_TIME); g_mx.unlock(); @@ -453,7 +453,7 @@ bool MmsPluginCmAgent::open() MSG_INFO("## WAITING UNTIL __connection_profile_state CONNECT. ##"); - time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); /* isCmOpened will changed by processCBdatas */ + time_ret = cv.timedwait(mx.pMsgMutex(), MMS_CONNECTION_API_WAIT_TIME); /* isCmOpened will changed by processCBdatas */ if (time_ret == ETIMEDOUT) { MSG_WARN("## WAKE by timeout ##"); @@ -505,7 +505,7 @@ void MmsPluginCmAgent::close() MSG_INFO("## WAITING UNTIL connection_profile_close_callback ##"); - time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); + time_ret = cv.timedwait(mx.pMsgMutex(), MMS_CONNECTION_API_WAIT_TIME); if (time_ret == ETIMEDOUT) { MSG_WARN("## WAKE by timeout ##"); diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp index 7de01c8..3bc8c9c 100755 --- a/plugin/mms_plugin/MmsPluginUserAgent.cpp +++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp @@ -228,7 +228,7 @@ void MmsPluginUaManager::start() { /* bool bStart = true; */ - MutexLocker lock(mx); + MsgMutexLocker lock(mx); if (!running) { running = true; diff --git a/plugin/mms_plugin/include/MmsPluginConnManWrapper.h b/plugin/mms_plugin/include/MmsPluginConnManWrapper.h index 5ef109f..77f55da 100755 --- a/plugin/mms_plugin/include/MmsPluginConnManWrapper.h +++ b/plugin/mms_plugin/include/MmsPluginConnManWrapper.h @@ -61,8 +61,8 @@ private: char *interface_name; char *proxy_address; char *dns_address_list; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* MMS_PLUGIN_CONNMAN_H */ diff --git a/plugin/mms_plugin/include/MmsPluginHttp.h b/plugin/mms_plugin/include/MmsPluginHttp.h index 239ff85..d7a8f61 100755 --- a/plugin/mms_plugin/include/MmsPluginHttp.h +++ b/plugin/mms_plugin/include/MmsPluginHttp.h @@ -78,12 +78,12 @@ class MmsPluginHttpAgent { MMS_HTTP_ERROR_E httpRequest(http_request_info_s &request_info); void setAbortFlag(){ - MutexLocker locker(mx); + MsgMutexLocker locker(mx); abort = true; }; bool getAbortFlag(){ - MutexLocker locker(mx); + MsgMutexLocker locker(mx); return abort; }; @@ -99,7 +99,7 @@ class MmsPluginHttpAgent { void clearSession(); void initAbortFlag(){ - MutexLocker locker(mx); + MsgMutexLocker locker(mx); abort = false; }; @@ -110,7 +110,7 @@ class MmsPluginHttpAgent { FILE *respfile; bool abort; - Mutex mx; + MsgMutex mx; }; #endif /* MMS_PLUGIN_HTTP_H */ diff --git a/plugin/mms_plugin/include/MmsPluginUserAgent.h b/plugin/mms_plugin/include/MmsPluginUserAgent.h index 25b8b0e..4ae9227 100755 --- a/plugin/mms_plugin/include/MmsPluginUserAgent.h +++ b/plugin/mms_plugin/include/MmsPluginUserAgent.h @@ -33,7 +33,7 @@ class MmsPluginUaManager: public MsgThread { void lock() { mx.lock(); } void unlock() { mx.unlock(); } - void wait() { cv.wait(mx.pMutex()); } + void wait() { cv.wait(mx.pMsgMutex()); } void signal() { cv.signal(); } private: @@ -43,8 +43,8 @@ class MmsPluginUaManager: public MsgThread { static MmsPluginUaManager *pInstance; virtual void run(); - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; MMS_NET_ERROR_T submitHandler(mmsTranQEntity *qEntity); MMS_NET_ERROR_T waitingConf(mmsTranQEntity *qEntity); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp index 4a5adfe..257da87 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp @@ -974,7 +974,7 @@ bool SmsPluginEventHandler::getDeviceStatus() mx.lock(); - ret = cv.timedwait(mx.pMutex(), 25); + ret = cv.timedwait(mx.pMsgMutex(), 25); if (ret == ETIMEDOUT) { MSG_DEBUG("WARNING: DEVICE STATUS TIME-OUT"); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp index ebb3f26..a6a4a18 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp @@ -51,8 +51,8 @@ GDBusConnection *gdbus_conn = NULL; GDBusProxy *gdbus_proxy = NULL; gint subs_id = 0; -Mutex mx; -CndVar cv; +MsgMutex mx; +MsgCndVar cv; void MsgResourceMonitorInit(void); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp index 703462e..dbb529f 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp @@ -487,7 +487,7 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt) mx.lock(); bTapiResult = false; - ret = cv.timedwait(mx.pMutex(), 25); + ret = cv.timedwait(mx.pMsgMutex(), 25); mx.unlock(); @@ -530,7 +530,7 @@ bool SmsPluginSetting::getResultImei(char *pImei) mx.lock(); - ret = cv.timedwait(mx.pMutex(), 25); + ret = cv.timedwait(mx.pMsgMutex(), 25); mx.unlock(); @@ -629,7 +629,7 @@ bool SmsPluginSetting::getResultFromSim() mx.lock(); - ret = cv.timedwait(mx.pMutex(), 25); + ret = cv.timedwait(mx.pMsgMutex(), 25); mx.unlock(); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp index 47e64ba..bb1457b 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp @@ -512,7 +512,7 @@ sms_network_status_t SmsPluginTransport::getNetStatus() int ret = 0; if (curStatus == SMS_NETWORK_SENDING) - ret = cv.timedwait(mx.pMutex(), 125); + ret = cv.timedwait(mx.pMsgMutex(), 125); mx.unlock(); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp index 020aef6..c999797 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp @@ -1044,10 +1044,10 @@ static void launchProcessByAppcode(int appcode) MSG_DEBUG("invoking service proxy call failed: %s\n", error->message); goto _DBUS_ERROR; } - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; mx.lock(); - cv.timedwait(mx.pMutex(), 2); + cv.timedwait(mx.pMsgMutex(), 2); mx.unlock(); MSG_END(); } diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h index ff02955..2822883 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h @@ -106,8 +106,8 @@ private: bool devStatus; bool bNeedInitConfig; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; vector wapList; void convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_deliver, MSG_MESSAGE_INFO_S *p_msg_info); diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h index 466b588..5261057 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h @@ -85,8 +85,8 @@ private: char meImei[MAX_ME_IMEI_LEN + 1]; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_CDMA_PLUGIN_SETTING_H */ diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h index 607f71f..005c95d 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h @@ -68,8 +68,8 @@ private: sms_network_status_t curStatus; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_PLUGIN_TRANSPORT_H */ diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h index 04f92f6..668df71 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h @@ -44,7 +44,7 @@ private: ~SmsPluginUAManager(); void lock() { mx.lock(); }; void unlock() { mx.unlock(); }; - void wait() { cv.wait(mx.pMutex()); }; + void wait() { cv.wait(mx.pMsgMutex()); }; void signal() { cv.signal(); }; virtual void run(); @@ -55,8 +55,8 @@ private: MsgSimpleQ smsTranQ; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_CDMA_PLUGIN_UA_MANAGER_H */ diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp index 7b12b83..91337fe 100755 --- a/plugin/sms_plugin/SmsPluginEventHandler.cpp +++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp @@ -1021,7 +1021,7 @@ bool SmsPluginEventHandler::getDeviceStatus(TapiHandle *handle) mx.lock(); devHandle = handle; - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); + ret = cv.timedwait(mx.pMsgMutex(), MAX_TAPI_SIM_API_TIMEOUT); if (ret == ETIMEDOUT) { MSG_WARN("WARNING: DEVICE STATUS TIME-OUT"); diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp index 5b9bcae..8cc99a8 100755 --- a/plugin/sms_plugin/SmsPluginMain.cpp +++ b/plugin/sms_plugin/SmsPluginMain.cpp @@ -51,8 +51,8 @@ gint subs_id = 0; bool isMemAvailable = true; -Mutex mx; -CndVar cv; +MsgMutex mx; +MsgCndVar cv; void MsgResourceMonitorInit(void); diff --git a/plugin/sms_plugin/SmsPluginSetting.cpp b/plugin/sms_plugin/SmsPluginSetting.cpp index ec2981d..f07a14f 100755 --- a/plugin/sms_plugin/SmsPluginSetting.cpp +++ b/plugin/sms_plugin/SmsPluginSetting.cpp @@ -99,8 +99,8 @@ SmsPluginSetting* SmsPluginSetting::instance() void* SmsPluginSetting::initSimInfo(void *data) { - static Mutex mm; - MutexLocker lock(mm); + static MsgMutex mm; + MsgMutexLocker lock(mm); instance()->processInitSimInfo(data); @@ -603,7 +603,7 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList) { MSG_BEGIN(); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); TelSmsParams_t smsParam = {0}; @@ -775,7 +775,7 @@ void SmsPluginSetting::setSmscInfo(const MSG_SMSC_LIST_S *pSmscList) { MSG_BEGIN(); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); int ret = TAPI_API_SUCCESS; @@ -839,7 +839,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt) MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NOT_FOUND; for (int i = 1; i <= simCnt; i++) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, i); @@ -901,7 +901,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt) MSG_DEBUG("SIM Index = [0], Set CB Receive is done"); return true; } else { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); handle = SmsPluginDSHandler::instance()->getTelHandle(pCbOpt->simIndex); @@ -979,7 +979,7 @@ bool SmsPluginSetting::getCbConfig(MSG_CBMSG_OPT_S *pCbOpt) void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt) { MSG_BEGIN(); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); int ret = TAPI_API_SUCCESS; bool *bShowError = NULL; /* When invalid voicemail data exists on SIM, update error should not be handled. */ @@ -1114,7 +1114,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt) bool SmsPluginSetting::getVoiceMailInfo(TapiHandle *handle) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); int ret = TAPI_API_SUCCESS; @@ -1281,7 +1281,7 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count) bool SmsPluginSetting::getMwiInfo(TapiHandle *handle) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); int ret = TAPI_API_SUCCESS; @@ -1307,7 +1307,7 @@ bool SmsPluginSetting::getMwiInfo(TapiHandle *handle) bool SmsPluginSetting::getMsisdnInfo(TapiHandle *handle) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); int ret = TAPI_API_SUCCESS; @@ -1333,7 +1333,7 @@ bool SmsPluginSetting::getMsisdnInfo(TapiHandle *handle) bool SmsPluginSetting::getSimServiceTable(TapiHandle *handle) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); int ret = TAPI_API_SUCCESS; @@ -1375,7 +1375,7 @@ int SmsPluginSetting::getParamCntEvent() mx.lock(); - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); + ret = cv.timedwait(mx.pMsgMutex(), MAX_TAPI_SIM_API_TIMEOUT); mx.unlock(); @@ -1419,7 +1419,7 @@ bool SmsPluginSetting::getParamEvent(TapiHandle *handle, MSG_SMSC_DATA_S *pSmscD mx.lock(); bTapiResult = false; - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); + ret = cv.timedwait(mx.pMsgMutex(), MAX_TAPI_SIM_API_TIMEOUT); mx.unlock(); @@ -1502,7 +1502,7 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt) mx.lock(); bTapiResult = false; - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); + ret = cv.timedwait(mx.pMsgMutex(), MAX_TAPI_SIM_API_TIMEOUT); mx.unlock(); @@ -1668,7 +1668,7 @@ bool SmsPluginSetting::getMailboxInfoEvent() mx.lock(); bTapiResult = false; - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); + ret = cv.timedwait(mx.pMsgMutex(), MAX_TAPI_SIM_API_TIMEOUT); mx.unlock(); @@ -1776,7 +1776,7 @@ bool SmsPluginSetting::getResultImei(char *pImei) mx.lock(); - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); + ret = cv.timedwait(mx.pMsgMutex(), MAX_TAPI_SIM_API_TIMEOUT); mx.unlock(); @@ -1811,7 +1811,7 @@ bool SmsPluginSetting::getResultFromSim() MSG_DEBUG("getResultFromSim() is called ."); - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); + ret = cv.timedwait(mx.pMsgMutex(), MAX_TAPI_SIM_API_TIMEOUT); if (ret == ETIMEDOUT) { MSG_DEBUG("WARNING: TAPI callback TIME-OUT"); diff --git a/plugin/sms_plugin/SmsPluginSimMsg.cpp b/plugin/sms_plugin/SmsPluginSimMsg.cpp index 4bf3d01..b234498 100755 --- a/plugin/sms_plugin/SmsPluginSimMsg.cpp +++ b/plugin/sms_plugin/SmsPluginSimMsg.cpp @@ -701,7 +701,7 @@ bool SmsPluginSimMsg::getSimMsgCntEvent(TapiHandle *handle, MSG_SIM_COUNT_S *pSi mx.lock(); - ret = cv.timedwait(mx.pMutex(), 10); + ret = cv.timedwait(mx.pMsgMutex(), 10); mx.unlock(); @@ -745,7 +745,7 @@ bool SmsPluginSimMsg::getSimMsgEvent(TapiHandle *handle, MSG_MESSAGE_INFO_S *pMs mx.lock(); bTapiResult = false; - ret = cv.timedwait(mx.pMutex(), 10); + ret = cv.timedwait(mx.pMsgMutex(), 10); mx.unlock(); @@ -899,7 +899,7 @@ bool SmsPluginSimMsg::getSimEvent(msg_sim_id_t *pSimId) mx.lock(); bTapiResult = false; - ret = cv.timedwait(mx.pMutex(), 10); + ret = cv.timedwait(mx.pMsgMutex(), 10); mx.unlock(); @@ -937,7 +937,7 @@ bool SmsPluginSimMsg::getDelSimEvent(int *pSimId) delSimMsgId = -1; bTapiResult = false; - ret = cv.timedwait(mx.pMutex(), 10); + ret = cv.timedwait(mx.pMsgMutex(), 10); mx.unlock(); diff --git a/plugin/sms_plugin/SmsPluginTransport.cpp b/plugin/sms_plugin/SmsPluginTransport.cpp index 11b8b06..0fa9936 100755 --- a/plugin/sms_plugin/SmsPluginTransport.cpp +++ b/plugin/sms_plugin/SmsPluginTransport.cpp @@ -1013,7 +1013,7 @@ SMS_NETWORK_STATUS_T SmsPluginTransport::getNetStatus() int ret = 0; if (curStatus == SMS_NETWORK_SENDING) - ret = cv.timedwait(mx.pMutex(), 125); + ret = cv.timedwait(mx.pMsgMutex(), 125); mx.unlock(); @@ -1047,7 +1047,7 @@ int SmsPluginTransport::getMoCtrlStatus() int ret = 0; - ret = cv.timedwait(mx.pMutex(), 10); + ret = cv.timedwait(mx.pMsgMutex(), 10); mx.unlock(); diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp index f294bb9..6f8191a 100755 --- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp +++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp @@ -1132,10 +1132,10 @@ static void launchProcessByAppcode(int appcode) goto _DBUS_ERROR; } - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; mx.lock(); - cv.timedwait(mx.pMutex(), 2); + cv.timedwait(mx.pMsgMutex(), 2); mx.unlock(); MSG_END(); diff --git a/plugin/sms_plugin/include/SmsPluginEventHandler.h b/plugin/sms_plugin/include/SmsPluginEventHandler.h index 4d9973a..78cbd68 100755 --- a/plugin/sms_plugin/include/SmsPluginEventHandler.h +++ b/plugin/sms_plugin/include/SmsPluginEventHandler.h @@ -79,8 +79,8 @@ private: bool bUdhMwiMethod; int udhMwiCnt; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; TapiHandle *devHandle; }; diff --git a/plugin/sms_plugin/include/SmsPluginSatHandler.h b/plugin/sms_plugin/include/SmsPluginSatHandler.h index d703456..288e4b5 100755 --- a/plugin/sms_plugin/include/SmsPluginSatHandler.h +++ b/plugin/sms_plugin/include/SmsPluginSatHandler.h @@ -65,8 +65,8 @@ private: bool bSMSPChanged; bool bCBMIChanged; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_PLUGIN_SAT_HANDLER_H */ diff --git a/plugin/sms_plugin/include/SmsPluginSetting.h b/plugin/sms_plugin/include/SmsPluginSetting.h index f59ddab..741add8 100755 --- a/plugin/sms_plugin/include/SmsPluginSetting.h +++ b/plugin/sms_plugin/include/SmsPluginSetting.h @@ -127,8 +127,8 @@ private: bool bMbdnEnable[MAX_TELEPHONY_HANDLE_CNT]; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_PLUGIN_SETTING_H */ diff --git a/plugin/sms_plugin/include/SmsPluginSimMsg.h b/plugin/sms_plugin/include/SmsPluginSimMsg.h index 1e11050..2d8c54a 100755 --- a/plugin/sms_plugin/include/SmsPluginSimMsg.h +++ b/plugin/sms_plugin/include/SmsPluginSimMsg.h @@ -96,8 +96,8 @@ private: SMS_DATA_INFO_S simMsgDataInfo; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_PLUGIN_SIMMSG_H */ diff --git a/plugin/sms_plugin/include/SmsPluginTransport.h b/plugin/sms_plugin/include/SmsPluginTransport.h index bb9e1da..44f595c 100755 --- a/plugin/sms_plugin/include/SmsPluginTransport.h +++ b/plugin/sms_plugin/include/SmsPluginTransport.h @@ -80,8 +80,8 @@ private: SMS_NETWORK_STATUS_T curStatus; TelSatMoSmCtrlIndData_t curMoCtrlData; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_PLUGIN_TRANSPORT_H */ diff --git a/plugin/sms_plugin/include/SmsPluginUAManager.h b/plugin/sms_plugin/include/SmsPluginUAManager.h index 99fc809..9585c3f 100755 --- a/plugin/sms_plugin/include/SmsPluginUAManager.h +++ b/plugin/sms_plugin/include/SmsPluginUAManager.h @@ -44,7 +44,7 @@ private: ~SmsPluginUAManager(); void lock() { mx.lock(); }; void unlock() { mx.unlock(); }; - void wait() { cv.wait(mx.pMutex()); }; + void wait() { cv.wait(mx.pMsgMutex()); }; void signal() { cv.signal(); }; virtual void run(); @@ -53,8 +53,8 @@ private: MsgSimpleQ smsTranQ; - Mutex mx; - CndVar cv; + MsgMutex mx; + MsgCndVar cv; }; #endif /* SMS_PLUGIN_UA_MANAGER_H */ diff --git a/proxy/MsgHandleControl.cpp b/proxy/MsgHandleControl.cpp index 21478be..84631bc 100755 --- a/proxy/MsgHandleControl.cpp +++ b/proxy/MsgHandleControl.cpp @@ -109,7 +109,7 @@ void MsgHandle::write(const char *pCmdData, int cmdSize, char **ppEvent) int ret = 0; /* Send Command to MSG FW */ - MutexLocker lock(mx); + MsgMutexLocker lock(mx); ret = mClientSock.write(pCmdData, cmdSize); if (ret < 0) THROW(MsgException::IPC_ERROR, "IPC write error"); diff --git a/proxy/MsgProxyListener.cpp b/proxy/MsgProxyListener.cpp index 9e60ef6..a48c124 100755 --- a/proxy/MsgProxyListener.cpp +++ b/proxy/MsgProxyListener.cpp @@ -142,8 +142,8 @@ MsgProxyListener::~MsgProxyListener() MsgProxyListener* MsgProxyListener::instance() { - static Mutex mm; - MutexLocker lock(mm); + static MsgMutex mm; + MsgMutexLocker lock(mm); if (!pInstance) { pInstance = new MsgProxyListener(); @@ -155,7 +155,7 @@ MsgProxyListener* MsgProxyListener::instance() void MsgProxyListener::start(MsgHandle* pMsgHandle) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); this->insertOpenHandleSet(pMsgHandle); @@ -186,7 +186,7 @@ void MsgProxyListener::stop() { MSG_BEGIN(); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); if (running > 1) { running--; @@ -214,7 +214,7 @@ void MsgProxyListener::stop() bool MsgProxyListener::regSentStatusEventCB(MsgHandle* pMsgHandle, int fd, msg_sent_status_cb pfSentStatus, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = sentStatusCBList.begin(); @@ -241,7 +241,7 @@ bool MsgProxyListener::regSentStatusEventCB(MsgHandle* pMsgHandle, int fd, msg_s bool MsgProxyListener::regMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = newMessageCBList.begin(); @@ -268,7 +268,7 @@ bool MsgProxyListener::regMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, bool MsgProxyListener::regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = newMMSConfMessageCBList.begin(); @@ -303,7 +303,7 @@ bool MsgProxyListener::regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, i bool MsgProxyListener::regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = newPushMessageCBList.begin(); @@ -338,7 +338,7 @@ bool MsgProxyListener::regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, int bool MsgProxyListener::regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = newCBMessageCBList.begin(); @@ -367,7 +367,7 @@ bool MsgProxyListener::regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd bool MsgProxyListener::regReportMsgIncomingCB(MsgHandle* pMsgHandle, int fd, msg_report_msg_incoming_cb pfReportMessage, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = reportMessageCBList.begin(); @@ -395,7 +395,7 @@ bool MsgProxyListener::regReportMsgIncomingCB(MsgHandle* pMsgHandle, int fd, msg bool MsgProxyListener::regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = newSyncMLMessageCBList.begin(); @@ -422,7 +422,7 @@ bool MsgProxyListener::regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, in bool MsgProxyListener::regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = newLBSMessageCBList.begin(); @@ -449,7 +449,7 @@ bool MsgProxyListener::regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, int f bool MsgProxyListener::regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, int fd, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = operationSyncMLMessageCBList.begin(); @@ -476,7 +476,7 @@ bool MsgProxyListener::regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, i bool MsgProxyListener::regStorageChangeEventCB(MsgHandle* pMsgHandle, int fd, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam) { - MutexLocker lock(mx); + MsgMutexLocker lock(mx); std::list::iterator it = storageChangeCBList.begin(); @@ -505,7 +505,7 @@ void MsgProxyListener::clearListOfClosedHandle(MsgHandle* pMsgHandle) { MSG_BEGIN(); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); /* sent status CB list */ std::list::iterator it = sentStatusCBList.begin(); @@ -638,7 +638,7 @@ void MsgProxyListener::refreshListOfOpenedHandle(MsgHandle* pMsgHandle) { MSG_BEGIN(); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); /* sent status CB list */ std::list::iterator it = sentStatusCBList.begin(); @@ -1203,7 +1203,7 @@ int MsgProxyListener::readFromSocket(char** buf, unsigned int* len) void MsgProxyListener::resetProxyListener() { MSG_DEBUG("client Listener reset"); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); if (channel) { g_io_channel_unref(channel); @@ -1231,7 +1231,7 @@ void MsgProxyListener::resetProxyListener() void MsgProxyListener::refreshProxyListener() { MSG_DEBUG("refresh proxy listener"); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); handle_set::iterator it = openHandleSet.begin(); for (; it != openHandleSet.end(); it++) { @@ -1263,7 +1263,7 @@ void MsgProxyListener::insertOpenHandleSet(MsgHandle* pMsgHandle) { MSG_DEBUG("try to insert opened handle. handle=[%p]", pMsgHandle); - MutexLocker lock(mx); + MsgMutexLocker lock(mx); handle_set::iterator it = openHandleSet.find(pMsgHandle); if (it == openHandleSet.end()) { diff --git a/utils/MsgSqliteWrapper.cpp b/utils/MsgSqliteWrapper.cpp index 2cd4206..3aecc02 100755 --- a/utils/MsgSqliteWrapper.cpp +++ b/utils/MsgSqliteWrapper.cpp @@ -660,7 +660,7 @@ msg_error_t MsgConvertStrWithEscape(const char *input, char **output) typedef std::map dbMap_t; dbMap_t gDbHandles; -Mutex mu; +MsgMutex mu; MsgDbHandler *getDbHandle() { @@ -670,7 +670,7 @@ MsgDbHandler *getDbHandle() dbMap_t::iterator it = gDbHandles.find(self); if (it == gDbHandles.end()) { MSG_DEBUG("New DB handle added."); - MutexLocker locker(mu); + MsgMutexLocker locker(mu); tmp = new MsgDbHandler(); gDbHandles.insert(std::pair(self, tmp)); @@ -688,7 +688,7 @@ void removeDbHandle() dbMap_t::iterator it = gDbHandles.find(self); if (it != gDbHandles.end()) { - MutexLocker locker(mu); + MsgMutexLocker locker(mu); tmp = it->second; delete tmp; gDbHandles.erase(it); diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp index 0467c11..36894a7 100755 --- a/utils/MsgUtilFile.cpp +++ b/utils/MsgUtilFile.cpp @@ -47,21 +47,24 @@ extern "C" { #include } -Mutex g_mx; -CndVar g_cv; +MsgMutex g_mx; +MsgCndVar g_cv; void thumbnail_completed_cb(thumbnail_util_error_e error, const char *request_id, int thumb_width, int thumb_height, unsigned char *thumb_data, int thumb_size, void *user_data) { + MSG_BEGIN(); + + g_mx.lock(); + if (!user_data) { MSG_WARN("dstPath is NULL"); + g_cv.signal(); + g_mx.unlock(); return; } - MSG_BEGIN(); - - g_mx.lock(); MSG_DEBUG("=================[RESULT]"); MSG_DEBUG("error_code [%d]", error); MSG_DEBUG("request id [%s]", request_id); @@ -117,7 +120,7 @@ bool MakeThumbnail(char *srcPath, char *dstPath) return false; } - time_ret = g_cv.timedwait(g_mx.pMutex(), 5); + time_ret = g_cv.timedwait(g_mx.pMsgMutex(), 5); g_mx.unlock(); -- 2.7.4