这篇教程C++ u_entity函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中u_entity函数的典型用法代码示例。如果您正苦于以下问题:C++ u_entity函数的具体用法?C++ u_entity怎么用?C++ u_entity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了u_entity函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _ReadConditionNew_ReadCondition_ReadConditionNew( const gapi_sampleStateMask sample_states, const gapi_viewStateMask view_states, const gapi_instanceStateMask instance_states, _DataReader datareader, _DataReaderView datareaderview){ _ReadCondition _this; u_reader uReader; u_dataView uDataView; q_expr predicate; /* The datareader and the datareaderview (should) share * a baseclass and therefore it is not necessary to have * both a datareader and a datareaderview as properties. * At run-time the right owner can be determined */ _this = _ReadConditionAlloc(); if ( _this != NULL ) { if (datareaderview != NULL) { _ConditionInit(_Condition(_this), _Entity(datareaderview), _ReadConditionGetTriggerValue); } else { _ConditionInit(_Condition(_this), _Entity(datareader), _ReadConditionGetTriggerValue); } _this->dataReader = datareader; _this->dataReaderView = datareaderview; _this->readerMask.sampleStateMask = sample_states; _this->readerMask.viewStateMask = view_states; _this->readerMask.instanceStateMask = instance_states; predicate = q_parse("1=1"); if (datareaderview) { uDataView = u_dataView(_DataReaderViewUreaderView(datareaderview)); if ( predicate != NULL ) { _this->uQuery = u_queryNew(u_reader(uDataView), NULL, predicate, NULL); } } else { uReader = u_reader(_DataReaderUreader(datareader)); if ( predicate != NULL ) { _this->uQuery = u_queryNew(uReader, NULL, predicate, NULL); } } q_dispose(predicate); if (_this->uQuery != NULL) { u_entitySetUserData(u_entity(_this->uQuery),_this); _Condition(_this)->uEntity = u_entity(_this->uQuery); } else { _ConditionDispose(_Condition(_this)); _this = NULL; } } return _this;}
开发者ID:AmitShah,项目名称:opensplice,代码行数:60,
示例2: u_dispatcherGetEventMasku_resultu_dispatcherGetEventMask( u_dispatcher _this, c_ulong *eventMask){ v_observer ko; u_result result = U_RESULT_OK; if ((_this != NULL) && (eventMask != NULL)) { result = u_entityReadClaim(u_entity(_this), (v_entity*)(&ko)); if (result == U_RESULT_OK) { assert(ko); *eventMask = v_observerGetEventMask(ko); result = u_entityRelease(u_entity(_this)); if (result != U_RESULT_OK) { OS_REPORT(OS_ERROR, "u_dispatcherGetEventMask", 0, "Release observer failed."); } } else { OS_REPORT(OS_WARNING, "u_dispatcherGetEventMask", 0, "Failed to claim Dispatcher."); } } else { OS_REPORT(OS_ERROR,"u_dispatcherGetEventMask",0, "Illegal parameter."); result = U_RESULT_ILL_PARAM; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:29,
示例3: u_dispatcherNotifyu_resultu_dispatcherNotify( u_dispatcher _this){ v_observer ko; u_result result = U_RESULT_OK; if (_this != NULL) { result = u_entityReadClaim(u_entity(_this), (v_entity*)(&ko)); if (result == U_RESULT_OK) { assert(ko); /* Wakeup the dispatch thread */ v_observerLock(ko); v_observerNotify(ko, NULL, NULL); v_observerUnlock(ko); result = u_entityRelease(u_entity(_this)); if (result != U_RESULT_OK) { OS_REPORT(OS_ERROR, "u_dispatcherNotify", 0, "Release observer failed."); } } else { OS_REPORT(OS_WARNING, "u_dispatcherNotify", 0, "Failed to claim Dispatcher."); } } else { OS_REPORT(OS_ERROR,"u_dispatcherNotify",0, "Illegal parameter."); result = U_RESULT_ILL_PARAM; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:31,
示例4: u_readerGetMatchedPublicationsu_resultu_readerGetMatchedPublications ( u_reader _this, v_statusAction action, c_voidp arg){ v_dataReader reader; v_spliced spliced; v_kernel kernel; u_result result; c_iter participants; v_participant participant; result = U_RESULT_PRECONDITION_NOT_MET; if (_this != NULL) { result = u_entityReadClaim(u_entity(_this), (v_entity*)(&reader)); if ((result == U_RESULT_OK) && (reader != NULL)) { kernel = v_objectKernel(reader); participants = v_resolveParticipants(kernel, V_SPLICED_NAME); assert(c_iterLength(participants) == 1); participant = v_participant(c_iterTakeFirst(participants)); spliced = v_spliced(participant); c_free(participant); c_iterFree(participants); result = u_resultFromKernel( v_splicedGetMatchedPublications(spliced, v_dataReader(reader), action, arg)); u_entityRelease(u_entity(_this)); } } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:34,
示例5: u_topicContentFilterValidatec_boolu_topicContentFilterValidate ( u_topic _this, q_expr expr, c_value params[]){ v_topic topic; c_type type; c_bool result; q_expr subexpr, term; int i; v_filter filter; u_result uResult; result = FALSE; filter = NULL; uResult = u_entityReadClaim(u_entity(_this), (v_entity*)(&topic)); if (uResult == U_RESULT_OK) { assert(topic); type = v_topicMessageType(topic); i = 0; subexpr = q_getPar(expr, i); /* get rid of Q_EXPR_PROGRAM */ while ((term = q_getPar(subexpr, i++)) != NULL) { if (q_getTag(term) == Q_EXPR_WHERE) { filter = v_filterNew(topic, term, params); } } u_entityRelease(u_entity(_this)); } if (filter != NULL) { result = TRUE; c_free(filter); } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:35,
示例6: u_subscriberNewu_subscriberu_subscriberNew( u_participant p, const c_char *name, v_subscriberQos qos, c_bool enable){ u_subscriber _this = NULL; v_subscriber ks; v_participant kp = NULL; u_result result; if (name == NULL) { name = "No name specified"; } if (p != NULL) { result = u_entityWriteClaim(u_entity(p),(v_entity*)(&kp)); if (result == U_RESULT_OK) { assert(kp); ks = v_subscriberNew(kp,name,qos,enable); if (ks != NULL) { _this = u_entityAlloc(p,u_subscriber,ks,TRUE); if (_this != NULL) { result = u_subscriberInit(_this,p); if (result != U_RESULT_OK) { OS_REPORT_1(OS_ERROR, "u_subscriberNew", 0, "Initialisation failed. " "For DataReader: <%s>.", name); (void)u_subscriberFree(_this); _this = NULL; } } else { OS_REPORT_1(OS_ERROR, "u_subscriberNew", 0, "Create user proxy failed. " "For Subscriber: <%s>.", name); } c_free(ks); } else { OS_REPORT_1(OS_ERROR, "u_subscriberNew", 0, "Create kernel entity failed. " "For Subscriber: <%s>.", name); } result = u_entityRelease(u_entity(p)); if (result != U_RESULT_OK) { OS_REPORT_1(OS_WARNING, "u_subscriberNew", 0, "Could not release participant." "However subscriber <%s> is created.", name); } } else { OS_REPORT_1(OS_WARNING, "u_subscriberNew", 0, "Claim Participant failed. " "For Subscriber: <%s>.", name); } } else { OS_REPORT_1(OS_ERROR,"u_subscriberNew",0, "No Participant specified. " "For Subscriber: <%s>", name); } return _this;}
开发者ID:S73417H,项目名称:opensplice,代码行数:60,
示例7: u_readerGetDeadlineMissedStatusu_resultu_readerGetDeadlineMissedStatus( u_reader _this, c_bool reset, v_statusAction action, c_voidp arg){ v_reader reader; u_result result; result = U_RESULT_PRECONDITION_NOT_MET; if (_this != NULL) { result = u_entityReadClaim(u_entity(_this), (v_entity*)(&reader)); if (result == U_RESULT_OK){ result = u_resultFromKernel( v_readerGetDeadlineMissedStatus(reader, reset, (v_statusAction)action, arg)); u_entityRelease(u_entity(_this)); } else { OS_REPORT(OS_ERROR, "u_readerDeadlineMissedStatus", 0, "Illegal handle detected"); } } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:27,
示例8: u_serviceRenewLeaseu_resultu_serviceRenewLease( u_service _this, v_duration leasePeriod){ u_result r; v_service kernelService; if (_this == NULL) { r = U_RESULT_ILL_PARAM; } else { r = u_entityReadClaim(u_entity(_this), (v_entity*)(&kernelService)); if(r == U_RESULT_OK) { assert(kernelService); v_serviceRenewLease(kernelService, leasePeriod); r = u_entityRelease(u_entity(_this)); } else { OS_REPORT(OS_WARNING, "u_serviceRenewLease", 0, "Failed to claim service."); } } return r;}
开发者ID:S73417H,项目名称:opensplice,代码行数:25,
示例9: u_subscriberDeleteContainedEntitiesu_resultu_subscriberDeleteContainedEntities ( u_subscriber _this){ u_result result; u_reader reader; c_iter list; if (_this != NULL) { result = u_entityLock(u_entity(_this)); if (result == U_RESULT_OK) { list = _this->readers; _this->readers = NULL; /* Unlock here because following code will take this lock. */ u_entityUnlock(u_entity(_this)); reader = c_iterTakeFirst(list); while (reader) { switch (u_entityKind(u_entity(reader))) { case U_READER: result = u_dataReaderDeleteContainedEntities(u_dataReader(reader)); result = u_dataReaderFree(u_dataReader(reader)); break; case U_GROUPQUEUE: result = u_groupQueueFree(u_groupQueue(reader)); break; case U_DATAVIEW: result = u_dataViewFree(u_dataView(reader)); break; case U_NETWORKREADER: result = u_networkReaderFree(u_networkReader(reader)); break; default: OS_REPORT_2(OS_WARNING, "u_subscriberDeleteContainedEntities",0, "invalid object type: " "For Subscriber = 0x%x, found Reader type = %s.", _this, u_kindImage(u_entityKind(u_entity(reader)))); assert(0); break; } u_entityDereference(u_entity(_this)); reader = c_iterTakeFirst(list); } c_iterFree(list); } else { OS_REPORT_2(OS_WARNING, "u_subscriberDeleteContainedEntities",0, "Operation u_entityLock failed: " "Subscriber = 0x%x, result = %s.", _this, u_resultImage(result)); } } else { OS_REPORT(OS_WARNING, "u_subscriberDeleteContainedEntities",0, "Invalid Subscriber <NULL>."); result = U_RESULT_ILL_PARAM; } return result;}
开发者ID:diorahman,项目名称:opensplice,代码行数:59,
示例10: cmx_writerNewc_char*cmx_writerNew( const c_char* publisher, const c_char* name, const c_char* topic, const c_char* qos){ u_publisher pub; u_topic top; u_writer wri; c_char* result; cmx_entityArg arg; u_result ur; cmx_entityKernelArg kernelArg; v_writerQos wQos; result = NULL; pub = u_publisher(cmx_entityUserEntity(publisher)); if(pub != NULL){ top = u_topic(cmx_entityUserEntity(topic)); if(top != NULL){ kernelArg = cmx_entityKernelArg(os_malloc(C_SIZEOF(cmx_entityKernelArg))); u_entityAction(u_entity(pub), cmx_entityKernelAction, (c_voidp)kernelArg); if(qos != NULL){ wQos = v_writerQos(cmx_qosKernelQosFromKind(qos, K_WRITER, c_getBase(c_object(kernelArg->kernel)))); if(wQos == NULL){ wQos = v_writerQosNew(kernelArg->kernel, NULL); wQos->reliability.kind = V_RELIABILITY_RELIABLE; } } else { wQos = v_writerQosNew(kernelArg->kernel, NULL); wQos->reliability.kind = V_RELIABILITY_RELIABLE; } wri = u_writerNew(pub, name, top, NULL, wQos, TRUE); os_free(kernelArg); c_free(wQos); if(wri != NULL){ cmx_registerEntity(u_entity(wri)); arg = cmx_entityArg(os_malloc(C_SIZEOF(cmx_entityArg))); arg->entity = u_entity(wri); arg->create = FALSE; arg->participant = NULL; arg->result = NULL; ur = u_entityAction(u_entity(wri), cmx_entityNewFromAction, (c_voidp)(arg)); if(ur == U_RESULT_OK){ result = arg->result; os_free(arg); } } } } return result;}
开发者ID:diorahman,项目名称:opensplice,代码行数:59,
示例11: u_groupQueueNewu_groupQueueu_groupQueueNew( u_subscriber s, const c_char *name, c_ulong queueSize, v_readerQos qos){ u_participant p; u_groupQueue _this = NULL; v_subscriber ks = NULL; v_groupQueue kn; u_result result; if (name != NULL) { if (s != NULL) { result = u_entityWriteClaim(u_entity(s),(v_entity*)(&ks)); if (result == U_RESULT_OK) { assert(ks); kn = v_groupQueueNew(ks,name,queueSize,qos); if (kn != NULL) { p = u_entityParticipant(u_entity(s)); _this = u_entityAlloc(p,u_groupQueue,kn,TRUE); if (_this != NULL) { result = u_groupQueueInit(_this,s); if (result != U_RESULT_OK) { OS_REPORT_1(OS_ERROR, "u_groupQueueNew", 0, "Initialisation failed. " "For groupQueue: <%s>.", name); u_groupQueueFree(_this); } } else { OS_REPORT_1(OS_ERROR, "u_groupQueueNew", 0, "Create proxy failed. " "For groupQueue: <%s>.", name); } c_free(kn); } else { OS_REPORT_1(OS_ERROR, "u_groupQueueNew", 0, "Create kernel entity failed. " "For groupQueue: <%s>.", name); } result = u_entityRelease(u_entity(s)); } else { OS_REPORT_2(OS_WARNING, "u_groupQueueNew", 0, "Claim Subscriber (0x%x) failed. " "For groupQueue: <%s>.", s, name); } } else { OS_REPORT_1(OS_ERROR,"u_groupQueueNew",0, "No Subscriber specified. " "For groupQueue: <%s>", name); } } else { OS_REPORT(OS_ERROR,"u_groupQueueNew",0, "No name specified."); } return _this;}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:58,
示例12: cmx_participantNewc_char*cmx_participantNew( const c_char* uri, const c_char* domainId, c_long timeout, const c_char* name, const c_char* qos){ u_participant p; u_result ur; u_domainId_t did; int pos; c_char* result; const c_char* context; if (*domainId == '/0') { did = U_DOMAIN_ID_ANY; } else if (sscanf (domainId,"%d%n", &did, &pos) != 1 || domainId[pos] != '/0') { OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "cmx_participantNew failed (reason: illegal argument: domainId /"%s/").", domainId); return NULL; } p = u_participantNew(uri, did, timeout > 0 ? (unsigned)timeout : 0, name, NULL, TRUE); if(p == NULL){ /* Error reported by u_participantNew() */ goto err_u_participantNew; } if(qos && *qos){ if((ur = u_entitySetXMLQos(u_entity(p), qos)) != U_RESULT_OK) { context = "u_entitySetXMLQos"; goto err_entity; } } if((ur = u_entityEnable(u_entity(p))) != U_RESULT_OK) { context = "u_entityEnable"; goto err_entity; } if((ur = cmx_entityRegister(u_object(p), NULL, &result)) != U_RESULT_OK) { context = "cmx_entityRegister"; goto err_entity; } return result;/* Error handling */err_entity: OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "cmx_participantNew failed (reason: %s returned %u).", context, ur); u_objectFree(u_object(p));err_u_participantNew: return NULL;}
开发者ID:osrf,项目名称:opensplice,代码行数:58,
示例13: d_waitsetDeinitvoidd_waitsetDeinit( d_object object){ d_waitset waitset; d_waitsetEntity we; d_waitsetHelper helper; assert(d_objectIsValid(object, D_WAITSET) == TRUE); if(object){ waitset = d_waitset(object); waitset->terminate = TRUE; if(waitset->runToCompletion == TRUE){ if(os_threadIdToInteger(waitset->thread)) { u_waitsetNotify(waitset->uwaitset, NULL); os_threadWaitExit(waitset->thread, NULL); } } else { if(waitset->threads){ helper = d_waitsetHelper(c_iterTakeFirst(waitset->threads)); while(helper){ helper->terminate = TRUE; u_waitsetNotify(helper->userWaitset, NULL); os_threadWaitExit(helper->tid, NULL); u_waitsetDetach(helper->userWaitset, u_entity(helper->entity->dispatcher)); u_waitsetFree(helper->userWaitset); os_free(helper); helper = d_waitsetHelper(c_iterTakeFirst(waitset->threads)); } c_iterFree(waitset->threads); waitset->threads = NULL; } } d_lockLock(d_lock(waitset)); if(waitset->entities) { we = d_waitsetEntity(c_iterTakeFirst(waitset->entities)); while(we) { if(waitset->runToCompletion == TRUE){ u_waitsetDetach(waitset->uwaitset, u_entity(we->dispatcher)); } d_waitsetEntityFree(we); we = d_waitsetEntity(c_iterTakeFirst(waitset->entities)); } c_iterFree(waitset->entities); } if(waitset->runToCompletion == TRUE){ if(waitset->uwaitset) { u_waitsetFree(waitset->uwaitset); } } d_lockUnlock(d_lock(waitset)); }}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:58,
示例14: dispatchstatic void *dispatch( void *o){ u_dispatcher _this; v_observer claim; struct listenerExecArg arg; u_result result; _this = u_dispatcher(o); if (_this != NULL) { if (_this->startAction) { _this->startAction(_this, _this->actionData); } os_mutexLock(&_this->mutex); result = u_entityReadClaim(u_entity(_this), (v_entity*)(&claim)); if(result == U_RESULT_OK) { assert(claim); while ((!(_this->event & V_EVENT_OBJECT_DESTROYED)) && (_this->listeners != NULL) && (c_iterLength(_this->listeners) > 0)) { os_mutexUnlock(&_this->mutex); _this->event = v_observerWait(claim); os_mutexLock(&_this->mutex); if (!(_this->event & V_EVENT_OBJECT_DESTROYED)) { /* do not call listeners when object is destroyed! */ arg.mask = 0; arg.o = _this; c_iterWalk(_this->listeners, (c_iterWalkAction)listenerExecute, &arg); } } _this->threadId = OS_THREAD_ID_NONE; result = u_entityRelease(u_entity(_this)); if (result != U_RESULT_OK) { OS_REPORT(OS_ERROR, "u_dispatcher::dispatch", 0, "Release observer failed."); } } else { OS_REPORT(OS_WARNING, "u_dispatcher::dispatch", 0, "Failed to claim Dispatcher."); } os_mutexUnlock(&_this->mutex); if (_this->stopAction) { _this->stopAction(_this, _this->actionData); } } else { OS_REPORT(OS_ERROR, "u_dispatcher::dispatch", 0, "No dispatcher specified."); } return NULL;}
开发者ID:S73417H,项目名称:opensplice,代码行数:54,
示例15: u_dispatcherDeinitu_resultu_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;}
开发者ID:S73417H,项目名称:opensplice,代码行数:52,
示例16: u_partitionNewu_partitionu_partitionNew( u_participant p, const c_char *name, v_partitionQos qos){ u_partition _this = NULL; v_kernel ke = NULL; v_partition kd; u_result result; if (name == NULL) { name = "No partition specified"; } if (p != NULL) { result = u_entityWriteClaim(u_entity(u_participantDomain(p)),(v_entity*)(&ke)); if ((result == U_RESULT_OK) && (ke != NULL)) { kd = v_partitionNew(ke,name,qos); if (kd != NULL) { _this = u_entityAlloc(p,u_partition,kd,FALSE); if (_this != NULL) { result = u_partitionInit(_this); if (result != U_RESULT_OK) { OS_REPORT_1(OS_ERROR, "u_partitionNew", 0, "Initialisation failed. " "For Partition: <%s>.", name); u_partitionFree(_this); } } else { OS_REPORT_1(OS_ERROR, "u_partitionNew", 0, "Create proxy failed. " "For Partition: <%s>.", name); } c_free(kd); } else { OS_REPORT_1(OS_ERROR, "u_partitionNew", 0, "Create kernel entity failed. " "For Partition: <%s>", name); } result = u_entityRelease(u_entity(u_participantDomain(p))); } else { OS_REPORT_1(OS_WARNING, "u_partitionNew", 0, "Claim Participant failed. " "For Partition: <%s>", name); } } else { OS_REPORT_1(OS_ERROR,"u_partitionNew",0, "No Participant specified. " "For Partition: <%s>", name); } return _this;}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:52,
示例17: cmx_publisherNewc_char*cmx_publisherNew( const c_char* participant, const c_char* name, const c_char* qos){ u_participant par; u_publisher pub; c_char* result; cmx_entityArg arg; u_result ur; v_publisherQos pqos; cmx_entityKernelArg kernelArg; result = NULL; par = u_participant(cmx_entityUserEntity(participant)); if(par != NULL){ kernelArg = cmx_entityKernelArg(os_malloc(C_SIZEOF(cmx_entityKernelArg))); u_entityAction(u_entity(par), cmx_entityKernelAction, (c_voidp)kernelArg); if(qos != NULL){ pqos = v_publisherQos(cmx_qosKernelQosFromKind(qos, K_PUBLISHER, c_getBase(c_object(kernelArg->kernel)))); if(pqos == NULL){ pqos = v_publisherQosNew(kernelArg->kernel, NULL); } } else { pqos = v_publisherQosNew(kernelArg->kernel, NULL); } pub = u_publisherNew(par, name, pqos, TRUE); os_free(kernelArg); c_free(pqos); if(pub != NULL){ cmx_registerEntity(u_entity(pub)); arg = cmx_entityArg(os_malloc(C_SIZEOF(cmx_entityArg))); arg->entity = u_entity(pub); arg->create = FALSE; arg->participant = NULL; arg->result = NULL; ur = u_entityAction(u_entity(pub), cmx_entityNewFromAction, (c_voidp)(arg)); if(ur == U_RESULT_OK){ result = arg->result; os_free(arg); } } } return result;}
开发者ID:diorahman,项目名称:opensplice,代码行数:51,
示例18: u_dispatcherInsertListeneru_resultu_dispatcherInsertListener( u_dispatcher _this, u_dispatcherListener listener, c_voidp userData){ u_listener ul; os_threadAttr attr; v_observer ke; u_result result = U_RESULT_OK; c_char *name; if ((_this != NULL) && (listener != NULL)) { os_mutexLock(&_this->mutex); ul = u_listenerNew(listener,userData); _this->listeners = c_iterInsert(_this->listeners,ul); if (os_threadIdToInteger(_this->threadId) == 0U) { result = u_entityReadClaim(u_entity(_this), (v_entity*)(&ke)); if(result == U_RESULT_OK) { assert(ke); name = v_entityName(ke); if (name == NULL) { name = "NoName"; } os_threadAttrInit(&attr); os_threadCreate(&_this->threadId, name, &attr,dispatch, (void *)_this); result = u_entityRelease(u_entity(_this)); if (result != U_RESULT_OK) { OS_REPORT(OS_ERROR, "u_dispatcherInsertListener", 0, "Release observer failed."); } } else { OS_REPORT(OS_WARNING, "u_dispatcherInsertListener", 0, "Failed to claim Dispatcher."); } } u_entityEnable(u_entity(_this)); os_mutexUnlock(&_this->mutex); } else { OS_REPORT(OS_ERROR,"u_dispatcherInsertListener",0, "Illegal parameter."); result = U_RESULT_ILL_PARAM; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:50,
示例19: u_dispatcherRemoveListeneru_resultu_dispatcherRemoveListener( u_dispatcher _this, u_dispatcherListener listener){ u_listener ul; v_observer ko; os_threadId tid; u_result result = U_RESULT_OK; struct compareArg arg; if ((_this != NULL) && (listener != NULL)) { os_mutexLock(&_this->mutex); arg.listener = listener; ul = (u_listener) c_iterResolve(_this->listeners, compare, &arg); tid = _this->threadId; if (ul != NULL) { c_iterTake(_this->listeners, ul); if (c_iterLength(_this->listeners) == 0) { result = u_entityReadClaim(u_entity(_this), (v_entity*)(&ko)); if(result == U_RESULT_OK) { assert(ko); /* Wakeup the dispatch thread */ v_observerLock(ko); v_observerNotify(ko, NULL, NULL); v_observerUnlock(ko); result = u_entityRelease(u_entity(_this)); if (result != U_RESULT_OK) { OS_REPORT(OS_ERROR, "u_dispatcherRemoveListener", 0, "Release observer failed."); } } else { OS_REPORT(OS_WARNING, "u_dispatcherRemoveListener", 0, "Failed to claim Dispatcher."); } } u_listenerFree(ul); } os_mutexUnlock(&_this->mutex); if ((c_iterLength(_this->listeners) == 0) && (os_threadIdToInteger(tid) != 0U)) { os_threadWaitExit(tid, NULL); } } else { OS_REPORT(OS_ERROR,"u_dispatcherInsertListener",0, "Illegal parameter."); result = U_RESULT_ILL_PARAM; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:50,
示例20: u_topicGetUserTypec_typeu_topicGetUserType ( u_topic _this){ v_topic topic; c_type type = NULL; u_result uResult = u_entityReadClaim(u_entity(_this), (v_entity*)(&topic)); if (uResult == U_RESULT_OK) { assert(topic); type = v_topicGetUserType(topic); c_keep(type); u_entityRelease(u_entity(_this)); } return type;}
开发者ID:S73417H,项目名称:opensplice,代码行数:15,
示例21: u_topicGetTopicKeysc_stringu_topicGetTopicKeys ( u_topic _this){ v_topic topic; c_string keys = NULL; u_result uResult = u_entityReadClaim(u_entity(_this), (v_entity*)(&topic)); if (uResult == U_RESULT_OK) { assert(topic); keys = v_topicKeyExpr(topic); c_keep(keys); u_entityRelease(u_entity(_this)); } return keys;}
开发者ID:S73417H,项目名称:opensplice,代码行数:15,
示例22: d_waitsetDetachc_boold_waitsetDetach( d_waitset waitset, d_waitsetEntity we){ u_result ur; c_bool result = FALSE; int i; d_waitsetHelper helper; helper = NULL; assert(d_objectIsValid(d_object(waitset), D_WAITSET) == TRUE); assert(d_objectIsValid(d_object(we), D_WAITSET_ENTITY) == TRUE); if(waitset && we){ d_lockLock(d_lock(waitset)); if(c_iterContains(waitset->entities, we) == TRUE) { if(waitset->runToCompletion == TRUE){ ur = u_waitsetDetach(waitset->uwaitset, u_entity(we->dispatcher)); } else { for(i=0; i<c_iterLength(waitset->threads) && !helper; i++){ helper = d_waitsetHelper(c_iterObject(waitset->threads, i)); if(helper->entity != we){ helper = NULL; } } assert(helper); c_iterTake(waitset->threads, helper); helper->terminate = TRUE; u_waitsetNotify(helper->userWaitset, NULL); os_threadWaitExit(helper->tid, NULL); ur = u_waitsetDetach(helper->userWaitset, u_entity(we->dispatcher)); u_waitsetFree(helper->userWaitset); os_free(helper); } if(ur == U_RESULT_OK) { c_iterTake(waitset->entities, we); we->waitset = NULL; result = TRUE; } } d_lockUnlock(d_lock(waitset)); } return result;}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:48,
示例23: u_readerLookupQueriesc_iteru_readerLookupQueries( u_reader _this){ c_iter queries = NULL; os_result r; if (_this) { if(u_entityOwner(u_entity(_this))) { r = os_mutexLock(&_this->mutex); if (r == os_resultSuccess) { c_iterWalk(_this->queries, collect_queries, &queries); os_mutexUnlock(&_this->mutex); } else { OS_REPORT(OS_WARNING, "u_readerLookupQueries",0, "Failed to lock Reader."); } } } else { OS_REPORT(OS_WARNING, "u_readerLookupQueries",0, "No Reader specified."); } return queries;}
开发者ID:S73417H,项目名称:opensplice,代码行数:26,
示例24: cms_soapThreadRunstatic void*cms_soapThreadRun( void *thr){ cms_soapThread thread; struct soap* soap; c_char* result; thread = cms_soapThread(thr); os_mutexLock(&thread->soapMutex); while(cms_thread(thread)->terminate == FALSE){ if(thread->soap != NULL){ soap = thread->soap; thread->soap = NULL; cms_thread(thread)->results = NULL; soap->user = thr; soap_serve(soap); soap_destroy(soap); soap_end(soap); soap_done(soap); free(soap); u_entityAction( u_entity(thread->client->service->uservice), cms_soapThreadStatisticsRequestHandledAdd, thread->client->service); if(cms_thread(thread)->results != NULL){ result = (c_char*)(c_iterTakeFirst(cms_thread(thread)->results)); while(result){ os_free(result); result = (c_char*)(c_iterTakeFirst(cms_thread(thread)->results)); } c_iterFree(cms_thread(thread)->results); cms_thread(thread)->results = NULL; } } if(cms_thread(thread)->terminate == FALSE){ cms_thread(thread)->ready = TRUE; if(thread->client->service->configuration->verbosity >= 7){ OS_REPORT_1(OS_INFO, CMS_CONTEXT, 0, "soapThread '%s' ready.", cms_thread(thread)->name); } os_condWait(&thread->condition, &thread->soapMutex); if(thread->client->service->configuration->verbosity >= 7){ OS_REPORT_1(OS_INFO, CMS_CONTEXT, 0, "soapThread '%s' condition triggered.", cms_thread(thread)->name); } } } os_mutexUnlock(&thread->soapMutex); if(thread->client->service->configuration->verbosity >= 6){ OS_REPORT_1(OS_INFO, CMS_CONTEXT, 0, "soapThread '%s' ends.", cms_thread(thread)->name); } return NULL;}
开发者ID:S73417H,项目名称:opensplice,代码行数:60,
示例25: u_readerWalkQueriesc_boolu_readerWalkQueries( u_reader _this, u_readerAction action, c_voidp actionArg){ c_bool result = U_RESULT_OK; os_result r; if (_this) { if(u_entityOwner(u_entity(_this))) { r = os_mutexLock(&_this->mutex); if (r == os_resultSuccess) { c_iterWalkUntil(_this->queries, (c_iterAction)action, actionArg); os_mutexUnlock(&_this->mutex); } else { OS_REPORT(OS_WARNING, "u_readerWalkQueries",0, "Failed to lock Reader."); result = U_RESULT_ILL_PARAM; } } } else { OS_REPORT(OS_WARNING, "u_readerWalkQueries",0, "No Reader specified."); result = U_RESULT_ILL_PARAM; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:30,
示例26: u_readerQueryCountc_longu_readerQueryCount( u_reader _this){ c_long length = -1; os_result r; if (_this) { if(u_entityOwner(u_entity(_this))) { r = os_mutexLock(&_this->mutex); if (r == os_resultSuccess) { length = c_iterLength(_this->queries); os_mutexUnlock(&_this->mutex); } else { OS_REPORT(OS_WARNING, "u_readerRemoveQuerie",0, "Failed to lock Reader."); } } } else { OS_REPORT(OS_WARNING, "u_readerQueryCount",0, "No Reader specified."); } return length;}
开发者ID:S73417H,项目名称:opensplice,代码行数:26,
示例27: u_readerContainsQueryc_boolu_readerContainsQuery( u_reader _this, u_query query){ c_bool found = FALSE; os_result r; if (_this && query) { if(u_entityOwner(u_entity(_this))) { r = os_mutexLock(&_this->mutex); if (r == os_resultSuccess) { found = c_iterContains(_this->queries,query); os_mutexUnlock(&_this->mutex); } else { OS_REPORT(OS_WARNING, "u_readerContainsQuery",0, "Failed to lock Reader."); } } } else { OS_REPORT(OS_WARNING, "u_readerRemoveQuery",0, "Illegal parameter."); } return found;}
开发者ID:S73417H,项目名称:opensplice,代码行数:27,
示例28: u_readerAddQueryu_resultu_readerAddQuery( u_reader _this, u_query query){ os_result r; u_result result = U_RESULT_PRECONDITION_NOT_MET; if (_this && query) { if(u_entityOwner(u_entity(_this))) { r = os_mutexLock(&_this->mutex); if (r == os_resultSuccess) { _this->queries = c_iterInsert(_this->queries, query); os_mutexUnlock(&_this->mutex); result = U_RESULT_OK; } else { OS_REPORT(OS_WARNING, "u_readerAddQuery",0, "Failed to lock Reader."); result = U_RESULT_ILL_PARAM; } } else { result = U_RESULT_OK; } } else { OS_REPORT(OS_WARNING, "u_readerAddQuery",0, "Illegal parameter."); result = U_RESULT_ILL_PARAM; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:32,
示例29: u_readerTakeNextInstanceu_resultu_readerTakeNextInstance( u_reader r, u_instanceHandle h, u_readerAction action, c_voidp actionArg){ u_result result; switch (u_entity(r)->kind) { case U_READER: result = u_dataReaderTakeNextInstance(u_dataReader(r), h, action, actionArg); break; case U_DATAVIEW: result = u_dataViewTakeNextInstance(u_dataView(r), h, action, actionArg); break; case U_QUERY: result = u_queryTakeNextInstance(u_query(r), h, action, actionArg); break; default: result = U_RESULT_ILL_PARAM; break; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:25,
示例30: u_readerTakeListvoid *u_readerTakeList( u_reader r, c_ulong max, u_readerCopyList copy, c_voidp copyArg){ void *result = NULL; switch (u_entity(r)->kind) { case U_READER: result = u_dataReaderTakeList(u_dataReader(r), max, copy, copyArg); break; case U_DATAVIEW: assert(FALSE); break; case U_QUERY: result = u_queryTakeList(u_query(r), max, copy, copyArg); break; default: result = NULL; break; } return result;}
开发者ID:S73417H,项目名称:opensplice,代码行数:25,
注:本文中的u_entity函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ u_errorName函数代码示例 C++ u_check函数代码示例 |