(void)data;
OIC_LOG(DEBUG, TAG, "IN - CAReceiveHandler");
- while (!caglobals.tcp.terminate)
+ while (true)
{
+ oc_mutex_lock(g_mutexObjectList);
+ if (caglobals.tcp.terminate)
+ {
+ oc_mutex_unlock(g_mutexObjectList);
+ break;
+ }
+ oc_mutex_unlock(g_mutexObjectList);
CAFindReadyMessage();
}
int ret = select(caglobals.tcp.maxfd + 1, &readFds, NULL, NULL, &timeout);
+ oc_mutex_lock(g_mutexObjectList);
if (caglobals.tcp.terminate)
{
+ oc_mutex_unlock(g_mutexObjectList);
OIC_LOG_V(INFO, TAG, "Packet receiver Stop request received.");
return;
}
+ oc_mutex_unlock(g_mutexObjectList);
if (0 >= ret)
{
if (0 > ret)
oc_cond_wait_for(g_condSend, g_mutexSend, waitTime);
oc_mutex_unlock(g_mutexSend);
+ oc_mutex_lock(g_mutexObjectList);
if (caglobals.tcp.terminate)
{
+ oc_mutex_unlock(g_mutexObjectList);
return len;
}
+ oc_mutex_unlock(g_mutexObjectList);
sendRetryTime = (sendRetryTime << 1);