return MA_ERROR_NONE;
}
#endif
-static int _wait_cb_ret(int msec)
+static int _wait_cb_ret(unsigned int msec)
{
OCStackResult ret = OC_STACK_OK;
-
+ unsigned int i, times = msec /100;
#ifndef THREAD_COND_WAIT_USED
struct timespec request, remaining;
- request.tv_sec = msec / 1000;
- request.tv_nsec = (msec % 1000) * 1000000;
+ request.tv_sec = 0;
+ request.tv_nsec = 1000000;
#endif
ma_check_null_ret_error("g_client", g_client, OC_STACK_INVALID_PARAM);
pthread_join(proc_a.thread, (void*) &result_a);
#else
- for (int i=0; !g_client->g_doneCB && msec > i; ++i) {
+ for (i = 0; !g_client->g_doneCB && times > i; ++i) {
+
ret = nanosleep(&request, &remaining);
if (-1 == ret && EINTR == errno) {
MA_LOGE( "Onanosleep error = %d", errno);
break;
}
+
g_mutex_lock(&iotivity_mutex);
ret = OCProcess();
g_mutex_unlock(&iotivity_mutex);
+
if (OC_STACK_OK != ret) {
MA_LOGE( "OCStack process error = %d", ret);
break;