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; }
u_result u_subscriberDeinit( u_subscriber _this) { u_result result; u_dataReader reader; c_iter list; if (_this != NULL) { result = u_participantRemoveSubscriber(_this->participant,_this); if (result == U_RESULT_OK) { _this->participant = NULL; if (_this->readers) { list = _this->readers; _this->readers = NULL; u_entityUnlock(u_entity(_this)); reader = c_iterTakeFirst(list); while (reader) { /* Readers should not exist at this point! * This loop corrects this erronous state. */ result = u_dataReaderFree(reader); u_entityDereference(u_entity(_this)); reader = c_iterTakeFirst(list); } c_iterFree(list); result = u_entityLock(u_entity(_this)); } result = u_dispatcherDeinit(u_dispatcher(_this)); } } else { OS_REPORT_1(OS_ERROR, "u_subscriberDeinit",0, "Illegal parameter: _this = 0x%x.", _this); result = U_RESULT_ILL_PARAM; } return result; }
u_result u_topicDeinit( u_topic _this) { u_result result; if (_this != NULL) { result = u_participantRemoveTopic(_this->participant, _this); if (result == U_RESULT_OK) { result = u_dispatcherDeinit(u_dispatcher(_this)); if (result == U_RESULT_OK) { if (_this->name) { os_free(_this->name); _this->name = NULL; } } else { OS_REPORT_1(OS_WARNING, "u_topicDeinit", 0, "Operation u_dispatcherDeinit failed. " "Topic = 0x%x", _this); } } else { OS_REPORT_2(OS_WARNING, "u_topicDeinit", 0, "The Topic (0x%x) could not be removed " "from the Participant (0x%x).", _this, _this->participant); } } else { OS_REPORT(OS_ERROR, "u_topicDeinit", 0, "Illegal parameter: Topic == NULL."); result = U_RESULT_ILL_PARAM; } return result; }