c_bool u_handleIsEqual( u_handle h1, u_handle h2) { return v_handleIsEqual (h1, h2); }
static c_bool groupExists(c_object o, c_voidp arg) { v_proxy p1 = v_proxy(o); struct groupExistsArg *a = (struct groupExistsArg *)arg; a->exists = v_handleIsEqual(p1->source, a->proxy->source); return !(a->exists); /* as long as a->equal==FALSE, continue walk */ }
static c_bool findProxy( c_object o, c_voidp arg) { v_proxy proxy = (v_proxy)o; findProxyArgument *a = (findProxyArgument *)arg; if (v_handleIsEqual(proxy->source,a->observable)) { a->proxy = proxy; return FALSE; } else { return TRUE; } }
void v_waitsetNotify( v_waitset _this, v_event e, c_voidp userData) /* the userData argument is the data associated to the observable * for this waitset during the v_waitsetAttach call. * This data is unique for this association between this waitset and * the attached observable. */ { v_waitsetEvent event,found; c_base base; v_historyDeleteEventData hde; v_waitsetEventHistoryDelete wehd; v_waitsetEventHistoryRequest wehr; v_waitsetEventPersistentSnapshot weps; v_kernel k; assert(_this != NULL); assert(C_TYPECHECK(_this,v_waitset)); if (e != NULL) { k = v_objectKernel(_this); if (e->kind == V_EVENT_HISTORY_DELETE) { /* delete historical data */ wehd = c_new(v_kernelType(k,K_WAITSETEVENTHISTORYDELETE)); base = c_getBase(c_object(_this)); hde = (v_historyDeleteEventData)e->userData; wehd->deleteTime = hde->deleteTime; wehd->partitionExpr = c_stringNew(base,hde->partitionExpression); wehd->topicExpr = c_stringNew(base,hde->topicExpression); event = (v_waitsetEvent)wehd; } else if (e->kind == V_EVENT_HISTORY_REQUEST) { /* request historical data */ wehr = c_new(v_kernelType(k, K_WAITSETEVENTHISTORYREQUEST)); wehr->request = (v_historicalDataRequest)c_keep(e->userData); event = (v_waitsetEvent)wehr; } else if (e->kind == V_EVENT_PERSISTENT_SNAPSHOT) { /* request persistent snapshot data */ weps = c_new(v_kernelType(k, K_WAITSETEVENTPERSISTENTSNAPSHOT)); weps->request = (v_persistentSnapshotRequest)c_keep(e->userData); event = (v_waitsetEvent)weps; } else { /* Group events by origin of event */ /* What about events while no threads are waiting? * It seems that the list of events can grow to infinite length. */ found = v_waitsetEvent(v_waitsetEventList(_this)); while ((found != NULL) && (!v_handleIsEqual(found->source,e->source))){ found = found->next; } if (found == NULL) { event = v_waitsetEventNew(_this); } else { found->kind |= e->kind; event = NULL; } } if (event) { event->source.server = e->source.server; event->source.index = e->source.index; event->source.serial = e->source.serial; event->kind = e->kind; event->userData = userData; event->next = v_waitsetEvent(v_waitsetEventList(_this)); v_waitsetEventList(_this) = (c_voidp)event; } } }