u_result u_readerInit( u_reader _this) { u_result result; os_result osResult; os_mutexAttr osMutexAttr; if (_this != NULL) { result = u_dispatcherInit(u_dispatcher(_this)); if (result == U_RESULT_OK) { _this->queries = NULL; osResult = os_mutexAttrInit(&osMutexAttr); if (osResult == os_resultSuccess) { osMutexAttr.scopeAttr = OS_SCOPE_PRIVATE; osResult = os_mutexInit(&_this->mutex, &osMutexAttr); if (osResult != os_resultSuccess) { result = U_RESULT_INTERNAL_ERROR; } } u_entity(_this)->flags |= U_ECREATE_INITIALISED; } } else { result = U_RESULT_ILL_PARAM; } return result; }
u_result u_subscriberInit( u_subscriber _this, u_participant p) { u_result result; if (_this != NULL) { result = u_dispatcherInit(u_dispatcher(_this)); if (result == U_RESULT_OK) { _this->readers = NULL; _this->participant = p; result = u_participantAddSubscriber(p,_this); } } else { OS_REPORT_2(OS_ERROR, "u_subscriberInit",0, "Illegal parameter: _this = 0x%x, participant = 0x%x.", _this,p); result = U_RESULT_ILL_PARAM; } return result; }
u_result u_topicInit( u_topic _this, const c_char *name, u_participant p) { u_result result; if (_this != NULL) { result = u_dispatcherInit(u_dispatcher(_this)); if (result == U_RESULT_OK) { _this->name = os_strdup(name); _this->participant = p; u_entity(_this)->flags |= U_ECREATE_INITIALISED; /* Note: redefinitions of the a topic are added to the list. */ result = u_participantAddTopic(p,_this); } } else { OS_REPORT(OS_ERROR,"u_topicInit",0, "Illegal parameter."); result = U_RESULT_ILL_PARAM; } return result; }