static void os__signalHandlerCallbackDeinit( os_signalHandlerCallbackInfo *_this) { os_signalHandlerExceptionCallbackInfo *ecb; os_signalHandlerExitRequestCallbackInfo *ercb; assert(_this); os_mutexLock(&_this->exceptionMtx); while((ecb = _this->exceptionCallbackInfo) != NULL){ _this->exceptionCallbackInfo = _this->exceptionCallbackInfo->next; os_signalHandlerExceptionRequestCallbackInfoDeinit(ecb); os_free(ecb); } os_mutexUnlock(&_this->exceptionMtx); os_mutexDestroy(&_this->exceptionMtx); os_mutexLock(&_this->exitRequestMtx); while((ercb = _this->exitRequestCallbackInfo) != NULL){ _this->exitRequestCallbackInfo = _this->exitRequestCallbackInfo->next; os_signalHandlerExitRequestCallbackInfoDeinit(ercb); os_free(ercb); } os_mutexUnlock(&_this->exitRequestMtx); os_mutexDestroy(&_this->exitRequestMtx); }
void cms_clientFree( cms_client client) { struct soap* soap; cms_soapThread soapThread; cms_thread(client)->terminate = TRUE; os_mutexLock(&client->conditionMutex); os_condSignal(&client->condition); os_mutexUnlock(&client->conditionMutex); cms_threadDeinit(cms_thread(client)); if(client->soapEnvs){ os_mutexLock(&client->soapMutex); soap = (struct soap*)(c_iterTakeFirst(client->soapEnvs)); while(soap){ soap->error = soap_receiver_fault(soap, "Service is terminating.", NULL); soap_send_fault(soap); soap_destroy(soap); soap_end(soap); soap_done(soap); os_free(soap); soap = (struct soap*)(c_iterTakeFirst(client->soapEnvs)); } c_iterFree(client->soapEnvs); client->soapEnvs = NULL; os_mutexUnlock(&client->soapMutex); } if(client->threads){ soapThread = cms_soapThread(c_iterTakeFirst(client->threads)); while(soapThread){ cms_soapThreadFree(soapThread); (void)u_observableAction(u_observable(client->service->uservice), cms_clientStatisticsThreadRemove, client->service); soapThread = cms_soapThread(c_iterTakeFirst(client->threads)); } c_iterFree(client->threads); client->threads = NULL; } os_mutexDestroy(&client->soapMutex); os_mutexDestroy(&client->threadMutex); os_mutexDestroy(&client->conditionMutex); os_condDestroy(&client->condition); client->initCount = 0; if(client->service->configuration->verbosity >= 5){ OS_REPORT(OS_INFO, CMS_CONTEXT, 0, "Client thread stopped for IP: %d.%d.%d.%d", (int)(client->ip>>24)&0xFF, (int)(client->ip>>16)&0xFF, (int)(client->ip>>8)&0xFF, (int)(client->ip&0xFF)); }
static gapi_boolean gapi_handleFree ( void *o) { gapi_handle handle = (gapi_handle) o; gapi_deleteEntityAction action = NULL; gapi_boolean result = TRUE; void *userData; void *actionData; UT_TRACE("gapi_handleFree(%x) %d\n",(unsigned int)handle, handle->kind); if (gapi_handleClaim(handle) == GAPI_RETCODE_OK) { assert(handle->deallocator); if ( handle->userData && handle->deleteActionInfo.action ) { action = handle->deleteActionInfo.action; userData = handle->userData; actionData = handle->deleteActionInfo.argument; } handle->beingDeleted = TRUE; if ( handle->object != NULL ) { result = handle->deallocator(handle->object); if ((handle->kind == OBJECT_KIND_WAITSET) && (handle->registry != NULL)) { _ObjectRegistryDeregister(handle->registry, handle); handle->registry = NULL; handle->object = NULL; } /* Only release _Object when deallocator returned successfully. */ if (result) { os_free(handle->object); handle->object = NULL; } } if ( result && action ) { action(userData, actionData); } /* Only release handle when deallocator returned successfully. */ if (result == TRUE) { assert(handle->registry == NULL); handle->magic = 0; gapi_handleRelease(handle); os_condDestroy(&handle->cv); os_mutexDestroy(&handle->mutex); #ifdef _RWLOCK_ os_mutexDestroy(&handle->read); #endif } else { gapi_handleRelease(handle); } } return result; }
u_result u_dispatcherDeinit( u_dispatcher _this) { v_observer ko; u_listener listener; os_threadId tid; u_result result = U_RESULT_OK; if (_this != NULL) { os_mutexLock(&_this->mutex); listener = u_listener(c_iterTakeFirst(_this->listeners)); while (listener != NULL) { u_listenerFree(listener); listener = u_listener(c_iterTakeFirst(_this->listeners)); } c_iterFree(_this->listeners); _this->listeners = NULL; /* Flags the dispatch thread to stop */ if (os_threadIdToInteger(_this->threadId) != 0U) { tid = _this->threadId; result = u_entityReadClaim(u_entity(_this), (v_entity*)(&ko)); if(result != U_RESULT_OK) { /* This is a valid situation when a participant has been * freed prior to the freeing of a dispatcher within the * participant. */ os_mutexUnlock(&_this->mutex); os_threadWaitExit(tid, NULL); os_mutexDestroy(&_this->mutex); /*return U_RESULT_INTERNAL_ERROR;*/ } else { /* Wakeup the dispatch thread */ v_observerLock(ko); v_observerNotify(ko, NULL, NULL); v_observerUnlock(ko); u_entityRelease(u_entity(_this)); os_mutexUnlock(&_this->mutex); os_threadWaitExit(tid, NULL); os_mutexDestroy(&_this->mutex); } } else { os_mutexUnlock(&_this->mutex); os_mutexDestroy(&_this->mutex); } result = u_entityDeinit(u_entity(_this)); } else { OS_REPORT(OS_ERROR,"u_dispatcherDeinit",0, "Illegal parameter."); result = U_RESULT_ILL_PARAM; } return result; }
u_result u_readerDeinit( u_reader _this) { u_result result; u_query query; if (_this != NULL) { result = u_dispatcherDeinit(u_dispatcher(_this)); if (result == U_RESULT_OK) { os_mutexLock(&_this->mutex); if (_this->queries) { query = c_iterObject(_this->queries,0); while (query) { os_mutexUnlock(&_this->mutex); result = u_queryFree(query); os_mutexLock(&_this->mutex); query = c_iterObject(_this->queries,0); } c_iterFree(_this->queries); _this->queries = NULL; } os_mutexUnlock(&_this->mutex); os_mutexDestroy(&_this->mutex); } } else { result = U_RESULT_ILL_PARAM; } return result; }
static os_result os__signalHandlerCallbackInit( os_signalHandlerCallbackInfo *_this) { os_result osr; assert(_this); osr = os_mutexInit(&_this->exitRequestMtx, NULL); if(osr != os_resultSuccess){ goto err_exitRequestMtxInit; } _this->exitRequestCallbackInfo = NULL; _this->nrExitRequestHandlers = 0; pa_st32(&_this->exitRequestInsertionIndex, 0xffffffff); _this->exitRequestConsumptionIndex = 0; osr = os_mutexInit(&_this->exceptionMtx, NULL); if(osr != os_resultSuccess){ goto err_exceptionMtxInit; } _this->exceptionCallbackInfo = NULL; return os_resultSuccess; /* Error handling */ err_exceptionMtxInit: os_mutexDestroy(&_this->exitRequestMtx); err_exitRequestMtxInit: return os_resultFail; }
DDS::Entity_impl::~Entity_impl() { if (os_mutexDestroy(&e_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "CCPP", 0, "Unable to destroy mutex"); } }
DDS::DataReaderView_impl::~DataReaderView_impl() { if (os_mutexDestroy(&drv_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "CCPP", 0, "Unable to destroy mutex"); } }
void _ObjectRegistryFree ( _ObjectRegistry registry) { gapi_handle handle; int ptr; assert(registry); os_mutexLock(®istry->mutex); ptr = 0; while ( registry->trash[ptr] != NULL ) { gapi__free(registry->trash[ptr]); registry->trash[ptr] = NULL; ptr = (ptr + 1)%TRASH_LENGTH; } handle = c_iterTakeFirst(registry->active); while ( handle != NULL ) { handle->registry = NULL; gapi__free(handle); handle = c_iterTakeFirst(registry->active); } c_iterFree(registry->active); os_mutexUnlock(®istry->mutex); os_mutexDestroy(®istry->mutex); os_free(registry); }
struct nn_servicelease *nn_servicelease_new (void (*renew_cb) (void *arg), void *renew_arg) { struct nn_servicelease *sl; sl = os_malloc (sizeof (*sl)); nn_retrieve_lease_settings (&sl->sleepTime); sl->keepgoing = -1; sl->renew_cb = renew_cb ? renew_cb : dummy_renew_cb; sl->renew_arg = renew_arg; sl->ts = NULL; if ((sl->av_ary = os_malloc (thread_states.nthreads * sizeof (*sl->av_ary))) == NULL) goto fail_vtimes; /* service lease update thread initializes av_ary */ if (os_mutexInit (&sl->lock, NULL) != os_resultSuccess) goto fail_lock; if (os_condInit (&sl->cond, &sl->lock, NULL) != os_resultSuccess) goto fail_cond; return sl; fail_cond: os_mutexDestroy (&sl->lock); fail_lock: os_free (sl->av_ary); fail_vtimes: os_free (sl); return NULL; }
os_boolean s_shmMonitorFree( s_shmMonitor _this) { os_boolean result = OS_TRUE; s_configuration config; os_result osr; if (_this != NULL) { config = splicedGetConfiguration(_this->spliceDaemon); os_mutexLock(&_this->mutex); _this->terminate = OS_TRUE; os_mutexUnlock(&_this->mutex); if (_this->thr != NULL) { osr = ut_threadTimedWaitExit(_this->thr, config->serviceTerminatePeriod, NULL); if (osr != os_resultSuccess) { OS_REPORT(OS_ERROR, OS_FUNCTION, osr, "Failed to join thread \"%s\":0x%" PA_PRIxADDR " (%s)", ut_threadGetName(_this->thr), (os_address)os_threadIdToInteger(ut_threadGetId(_this->thr)), os_resultImage(osr)); result = OS_FALSE; } } if (result) { os_mutexDestroy(&_this->mutex); os_condDestroy(&_this->cleanCondition); os_free(_this); } } return result; }
DDS::Subscriber_impl::~Subscriber_impl() { if (os_mutexDestroy(&s_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "CCPP", 0, "Unable to destroy mutex"); } }
DDS::DomainParticipant_impl::~DomainParticipant_impl() { if (os_mutexDestroy(&dp_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "CCPP", 0, "Unable to destroy mutex"); } }
/** \brief Destroy the rwlock * * \b os_rwlockDestroy destroys the mutex that implements the rwlock */ os_result os_rwlockDestroy ( os_rwlock *rwlock) { assert (rwlock != NULL); return os_mutexDestroy (rwlock); }
DDS::ContentFilteredTopic_impl::~ContentFilteredTopic_impl() { if (os_mutexDestroy(&cft_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "CCPP", 0, "Unable to destroy mutex"); } }
DDS::StatusCondition_impl::~StatusCondition_impl( ) { if (os_mutexDestroy(&sc_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "CCPP", 0, "Unable to destroy mutex"); } }
void _ObjectDelete ( _Object object) { gapi_handle handle; gapi_deleteEntityAction action = NULL; void *userData; void *actionData; assert(object); handle = (gapi_handle) object->handle; assert(handle); handle->object = NULL; object->handle = NULL; os_free(object); handle->object = NULL; action = handle->deleteActionInfo.action; if ( handle->userData && action ) { userData = handle->userData; actionData = handle->deleteActionInfo.argument; action(userData, actionData); } handle->userData = NULL; handle->magic = MAGIC_DELETED; if ( handle->registry != NULL ) { _ObjectRegistryDeregister(handle->registry, handle); } gapi_handleRelease(handle); os_condDestroy( &handle->cv ); os_mutexDestroy( &handle->mutex ); #ifdef _RWLOCK_ os_mutexDestroy(&handle->read); #endif if ( handle->registry == NULL ) { gapi__free(handle); } }
c_syncResult c_mutexDestroy ( c_mutex *mtx) { os_result result; #ifdef NDEBUG result = os_mutexDestroy(mtx); #else do { result = os_mutexDestroy(&mtx->mtx); if (result != os_resultSuccess) { assert(FALSE); /* create core dump */ } } while (result != os_resultSuccess); #endif return result; }
DDS::Publisher_impl::~Publisher_impl() { if (os_mutexDestroy(&p_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "DDS::Publisher_impl::~Publisher_impl", 0, "Unable to destroy mutex"); } }
void unref_addrset (struct addrset *as) { if (atomic_dec_u32_nv (&as->refc) == 0) { ut_avlCFree (&addrset_treedef, &as->ucaddrs, os_free); ut_avlCFree (&addrset_treedef, &as->mcaddrs, os_free); os_mutexDestroy (&as->lock); os_free (as); } }
void d_lockDeinit( d_object lock) { if(lock){ if(d_lock(lock)->deinit){ d_lock(lock)->deinit(lock); } os_mutexDestroy(&(d_lock(lock)->lock)); } }
/** \brief Initialize the mutex taking the mutex attributes * into account * * \b os_mutexInit calls \b pthread_mutex_init to intialize the * posix \b mutex * * In case the scope attribute is \b OS_SCOPE_SHARED, the posix * mutex "pshared" attribute is set to \b PTHREAD_PROCESS_SHARED * otherwise it is set to \b PTHREAD_PROCESS_PRIVATE. */ os_result os_mutexInit ( os_mutex *mutex, const os_mutexAttr *mutexAttr) { pthread_mutexattr_t mattr; int result = 0; os_result rv; assert (mutex != NULL); assert (mutexAttr != NULL); #ifdef OSPL_STRICT_MEM assert (mutex->signature != OS_MUTEX_MAGIC_SIG); #endif pthread_mutexattr_init (&mattr); if (mutexAttr->scopeAttr == OS_SCOPE_SHARED) { result = pthread_mutexattr_setpshared (&mattr, PTHREAD_PROCESS_SHARED); } else { result = pthread_mutexattr_setpshared (&mattr, PTHREAD_PROCESS_PRIVATE); } #ifdef OSPL_PRIO_INHERIT_SUPPORTED /* only if priority inheritance is supported in the pthread lib */ if ((result == 0) && ospl_mtx_prio_inherit) { result = pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_INHERIT); } #endif if (result == 0) { #ifdef OSPL_STRICT_MEM result = pthread_mutex_init (&mutex->mutex, &mattr); #else result = pthread_mutex_init (mutex, &mattr); if (result == EBUSY) { os_mutexDestroy (mutex); result = pthread_mutex_init (mutex, &mattr); } #endif } pthread_mutexattr_destroy (&mattr); if (result == 0) { rv = os_resultSuccess; #ifdef OSPL_STRICT_MEM mutex->signature = OS_MUTEX_MAGIC_SIG; #endif } else { OS_REPORT_2(OS_ERROR,"os_mutexInit",0, "Operation failed: mutex 0x%x, result = %s", mutex, strerror(result)); assert(OS_FALSE); rv = os_resultFail; } return rv; }
void nn_servicelease_free (struct nn_servicelease *sl) { if (sl->keepgoing != -1) { os_mutexLock (&sl->lock); sl->keepgoing = 0; os_condSignal (&sl->cond); os_mutexUnlock (&sl->lock); join_thread (sl->ts, (void **) 0); } os_condDestroy (&sl->cond); os_mutexDestroy (&sl->lock); os_free (sl->av_ary); os_free (sl); }
s_shmMonitor s_shmMonitorNew( spliced splicedaemon) { s_shmMonitor _this; os_result result; s_configuration config; assert(splicedaemon); config = splicedGetConfiguration(splicedaemon); assert(config); _this = os_malloc(sizeof *_this); _this->spliceDaemon = splicedaemon; _this->terminate = OS_FALSE; _this->thr = NULL; _this->shmState = SHM_STATE_CLEAN; result = os_mutexInit(&_this->mutex, NULL); if(result != os_resultSuccess){ OS_REPORT(OS_ERROR, OSRPT_CNTXT_SPLICED, 0, "Failed to init shm monitor mutex"); goto err_shmMonitor_mtx; } result = os_condInit(&_this->cleanCondition, &_this->mutex, NULL); if(result != os_resultSuccess){ OS_REPORT(OS_ERROR, OSRPT_CNTXT_SPLICED, 0, "Failed to init shm monitor cleanCondition"); goto err_shmMonitor_clean_cnd; } ut_threadCreate(splicedGetThreads(splicedaemon), &(_this->thr), "shmMonitor", &config->leaseRenewAttribute, shmMonitorMain, _this); if (_this->thr == NULL) { OS_REPORT(OS_ERROR, OSRPT_CNTXT_SPLICED, 0, "Failed to start shared memory monitor"); goto err_shmMonitor_thr; } return _this; /* Error handling */ err_shmMonitor_thr: os_condDestroy(&_this->cleanCondition); err_shmMonitor_clean_cnd: os_mutexDestroy(&_this->mutex); err_shmMonitor_mtx: os_free(_this); return NULL; }
void s_kernelManagerFree( s_kernelManager km) { u_result r; v_spliced s; if (km) { /* km might be NULL, when spliced has detected other spliced */ os_threadWaitExit(km->id, NULL); os_threadWaitExit(km->resendManager, NULL); u_splicedCAndMCommandDispatcherQuit(km->spliced); os_threadWaitExit(km->cAndMCommandManager, NULL); os_condDestroy(&km->cv); os_mutexDestroy(&km->mtx); os_free(km); } }
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); }
DDS::DataReader_impl::~DataReader_impl() { if(os_mutexLock(&dr_mutex) == os_resultSuccess) { pdc_terminateWorkers(pdc); pdc_joinWorkers(workers, nrofWorkers); assert(nrofWorkers == 0); os_mutexUnlock(&dr_mutex); } else { OS_REPORT(OS_FATAL, "CCPP", 0, "Unable to lock mutex"); } if(os_mutexDestroy(&dr_mutex) != os_resultSuccess) { OS_REPORT(OS_ERROR, "CCPP", 0, "Unable to destroy mutex"); } delete workers; delete pdc; return; }
void os_reportExit() { char * name; os_mutexDestroy(&reportMutex); if (error_log) { name = os_reportGetInfoFileName(); os_close_file(name, error_log); os_free (name); error_log = NULL; } if (info_log) { name = os_reportGetErrorFileName(); os_close_file(name, info_log); os_free (name); info_log = NULL; } }
void cms_soapThreadFree( cms_soapThread thread) { if(thread->client->service->configuration->verbosity >= 6){ OS_REPORT_1(OS_INFO, CMS_CONTEXT, 0, "Stopping soapThread '%s'...", cms_thread(thread)->name); } os_mutexLock(&thread->soapMutex); cms_thread(thread)->terminate = TRUE; os_condSignal(&thread->condition); os_mutexUnlock(&thread->soapMutex); cms_threadDeinit(cms_thread(thread)); if(thread->client->service->configuration->verbosity >= 6){ OS_REPORT_1(OS_INFO, CMS_CONTEXT, 0, "soapThread '%s' stopped.", cms_thread(thread)->name); } os_condDestroy(&thread->condition); os_mutexDestroy(&thread->soapMutex); os_free(cms_thread(thread)->uri); os_free(thread); }
int main( int argc, char* argv[]) { int result = 0; v_participantQos participantQos; u_result uresult; os_boolean success; v_subscriberQos subscriberQos; c_time resolution; c_base base; v_kernel kernel; /* Necessary to initialize the user layer. Do this just once per process.*/ mlv_init (); uresult = u_userInitialise(); mlv_setforreal (1); if(uresult == U_RESULT_OK){ /* Allocate default participant qos*/ participantQos = u_participantQosNew(NULL); { os_mutexAttr mattr; os_mutexAttrInit (&mattr); mattr.scopeAttr = OS_SCOPE_PRIVATE; os_mutexInit (&gluelock, &mattr); } if(participantQos){ if(argc > 1){ SERVICE_NAME = argv[1]; } if(argc > 2){ SERVICE_URI = argv[2]; } /*create participant*/ participant = u_participant(u_serviceNew( SERVICE_URI, 0, SERVICE_NAME, NULL, U_SERVICE_NETWORKING, (v_qos)participantQos)); if(participant){ struct cfgst *cfgst; ddsi2_participant_gid = u_entityGid (u_entity (participant)); /*Notify kernel that I am initializing. */ u_serviceChangeState(u_service(participant),STATE_INITIALISING); /*Start monitoring the splicedaemon state. I need to terminate if he says so*/ u_serviceWatchSpliceDaemon( u_service(participant), in_discoveryWatchSpliced, &terminate); if ((cfgst = config_init (participant, SERVICE_NAME)) != NULL) { unsigned rtps_flags = 0; struct nn_servicelease *servicelease; open_tracing_file (); /* Dependencies between default values is not handled automatically by the config processing (yet) */ if (config.many_sockets_mode) { if (config.max_participants == 0) config.max_participants = 100; } if (NN_STRICT_P) { /* Should not be sending invalid messages when strict */ config.respond_to_rti_init_zero_ack_with_invalid_heartbeat = 0; config.acknack_numbits_emptyset = 1; } config_print_and_free_cfgst (cfgst); servicelease = nn_servicelease_new (participant); nn_servicelease_start_renewing (servicelease); myNetworkId = getNetworkId (); u_entityAction(u_entity(participant), resolveKernelService, NULL); base = c_getBase(service); kernel = v_object(service)->kernel; rtps_init (base, kernel, config.domainId, config.participantIndex, rtps_flags, config.networkAddressString, config.peers); /* Initialize entity administration. */ success = in_entityAdminInit(participant); if(success){ /*Create subscriber to receive client writers' messages.*/ subscriberQos = u_subscriberQosNew(NULL); os_free(subscriberQos->partition); subscriberQos->partition = NULL; clientSubscriber = u_subscriberNew( participant, "clientSubscriber", subscriberQos, TRUE); if(clientSubscriber){ /*Create networkReader to be able to receive client writers' messages.*/ clientReader = u_networkReaderNew( clientSubscriber, "clientReader", NULL, TRUE); if(clientReader){ resolution.seconds = 0; resolution.nanoseconds = 10 * 1000 * 1000; /*10 ms*/ /*Create network queue*/ uresult = u_networkReaderCreateQueue( clientReader, 1000, 0, FALSE, FALSE, resolution, TRUE, &queueId, "DDSi"); if(uresult == U_RESULT_OK){ struct builtin_datareader_set drset; u_entityAction(u_entity(clientReader), resolveKernelReader, NULL); uresult = create_builtin_readers (&drset, participant); if (uresult == U_RESULT_OK) { u_serviceChangeState(u_service(participant),STATE_OPERATIONAL); uresult = attachAndMonitor(participant, &drset); if((uresult != U_RESULT_OK) && (uresult != U_RESULT_DETACHING)) { nn_log (LC_ERROR, "Abnormal termination...\n"); result = -1; } else { nn_log (LC_INFO, "Deleting entities...\n"); } destroy_builtin_readers (&drset); } else { nn_log (LC_FATAL, "Could not create subscription + readers for builtin topics.\n"); result = -1; } terminate = TRUE; v_networkReaderTrigger(vclientReader, queueId); os_threadWaitExit(clientWriterThread, NULL); } else { nn_log (LC_FATAL, "Could not create networkQueue.\n"); result = -1; } /*Clean up networkReader*/ os_mutexLock (&gluelock); u_networkReaderFree(clientReader); clientReader = NULL; vclientReader = NULL; os_mutexUnlock (&gluelock); } else { nn_log (LC_FATAL, "Could not create networkReader.\n"); result = -1; } /*Clean up subscriber*/ u_subscriberFree(clientSubscriber); } else { nn_log (LC_FATAL, "Could not create subscriber.\n"); result = -1; } /*Clean up entity administration*/ in_entityAdminDestroy(); } else { nn_log (LC_FATAL, "Could not initialize entity adminstration.\n"); result = -1; } /* RTPS layer now defines types, cleanup before detaching */ rtps_term(); /*Notify kernel that I've terminated*/ u_serviceChangeState(u_service(participant),STATE_TERMINATED); nn_servicelease_free (servicelease); /*Delete participant*/ uresult = u_serviceFree(u_service(participant)); if(uresult != U_RESULT_OK){ nn_log (LC_FATAL, "Deletion of participant failed.\n"); result = -1; } } else { nn_log (LC_FATAL, "Initialization of configuration failed.\n"); result = -1; } } else { nn_log (LC_FATAL, "Could not create participant.\n"); result = -1; } u_participantQosFree (participantQos); } else { nn_log (LC_FATAL, "Could not allocate participantQos.\n"); result = -1; } os_mutexDestroy (&gluelock); /* Detach user layer */ mlv_setforreal (0); uresult = u_userDetach(); mlv_fini (); if(uresult != U_RESULT_OK){ nn_log (LC_FATAL, "Detachment of user layer failed.\n"); result = -1; } } else { nn_log (LC_FATAL, "Initialization of user layer failed.\n"); result = -1; } nn_log (LC_INFO, "Finis.\n"); /* Must be really late, or nn_log becomes unhappy -- but it should be before os_osExit (which appears to be called from u_userExit(), which is not called by u_userDetach but by an exit handler, it appears.) */ config_fini (); return result; }