static int _wait_cb_ret(int msec)
{
OCStackResult ret = OC_STACK_OK;
-
+ struct timespec tim, tim2;
+ tim.tv_sec = 0;
+ tim.tv_nsec = 100 * 1000000;
#ifndef THREAD_COND_WAIT_USED
struct timespec request, remaining;
request.tv_sec = msec / 1000;
pthread_join(proc_a.thread, (void*) &result_a);
#else
- for (int i=0; !g_client->g_doneCB && msec > i; i+=10) {
+ for (int i=0; !g_client->g_doneCB && msec > i; i+=100) {
/*
* Basically, nanosleep is more thread-safe function,
* But, in our case, nanosleep cause crash frequently
*/
- usleep(10000);
+ ret = nanosleep(&tim, &tim2);
+ if ( 0 > ret) {
+ MA_LOGE("nanosleep failed=%d", errno);
+ }
g_mutex_lock(&iotivity_mutex);
ret = OCProcess();