DDS::ReturnCode_t DDS::OpenSplice::Utils::copyDurationIn( const DDS::Duration_t &from, os_duration &to) { DDS::ReturnCode_t result = DDS::RETCODE_OK; if ((from.sec == DDS::DURATION_INFINITE_SEC) && (from.nanosec == DDS::DURATION_INFINITE_NSEC)) { to = OS_DURATION_INFINITE; } else if (from.sec >= 0 && from.nanosec < 1000000000) { to = OS_DURATION_INIT(from.sec, from.nanosec); } else { result = DDS::RETCODE_BAD_PARAMETER; } return result; }
static void u__waitsetFreeW( void *_this) { u_waitset w; w = u_waitset(_this); while (pa_ld32(&w->useCount) > 0) { os_duration t = OS_DURATION_INIT(0, 100000000); ospl_os_sleep(t); } (void) os_condDestroy(&w->waitCv); (void) os_condDestroy(&w->cv); (void) os_mutexDestroy(&w->mutex); u__objectFreeW(_this); }
void v_listenerFree( v_listener _this) { v_participant p; v_listenerEvent event; os_duration delay; assert(_this != NULL); assert(C_TYPECHECK(_this,v_listener)); p = v_participant(_this->participant); assert(p != NULL); c_mutexLock(&_this->mutex); /* wakeup blocking threads to evaluate new condition. */ /* remove all events */ while (_this->eventList != NULL) { event = _this->eventList; _this->eventList = event->next; v_listenerEventDeinit(event); c_free(event); } _this->eventList = NULL; c_free(_this->lastEvent); _this->lastEvent = NULL; _this->terminate = TRUE; c_condBroadcast(&_this->cv); c_mutexUnlock(&_this->mutex); delay = OS_DURATION_INIT(0, 1000); while (_this->waitCount > 0 && !p->processIsZombie) { ospl_os_sleep(delay); } v_participantRemove(p, v_object(_this)); _this->participant = NULL; v_publicFree(v_public(_this)); }