void prvTask (void* pvParameters) { TickType_t xLastWakeTime = xTaskGetTickCount(); int value = 0; int count; while(1) { while(M[1]==0) ; count = 3000; while(count--) ; value = M[1]; vTaskDelayUntil( &xLastWakeTime, 10 ); sendMsgTo(value, 0, 1, 0); c2c_payload message; if (xQueueReceive( xRecvQueue, &message, portMAX_DELAY ) == pdTRUE) { M[2] = message.msg; } else { M[2] = -1; } count = 3000; while(count--) ; M[1] = 0; count = 3000; while(count--) ; } }
int rinvoke(State *state, Object obj, int fn) { RemoteOpHeader h; u32 sb, sp = state->sp; int retc, argc; Node srv; Stream str; ConcreteType ct; regRoot(obj); regRoot(state); anticipateGC(64 * 1024); unregRoot(); unregRoot(); /* figure out where we're sending the invocation */ ct = CODEPTR(obj->flags); assert(!RESDNT(obj->flags)); srv = getLocFromObj(obj); /* figure out what object we're invoking on */ h.target = OIDOf(obj); if (isNoOID(h.target)) { ConcreteType ct = CODEPTR(obj->flags); printf("It was a %.*s\n", ct->d.name->d.items, ct->d.name->d.data); return debug(state, "Invoked object with no oid"); } assert(!isNoOID(h.target)); h.targetct = OIDOf(ct); /* push the header information */ h.kind = InvokeRequest; h.status = fn; h.option1 = retc = ct->d.opVector->d.data[fn]->d.nress; h.option2 = argc = ct->d.opVector->d.data[fn]->d.nargs; h.ss = OIDOf((Object)state); h.sslocation = myid; str = StartMsg(&h); state->nstoid = h.target; NewOID(&state->nsoid); TRACE(process, 5, ("Setting nsoid in state %#x to %s", state, OIDString(state->nsoid))); WriteOID(&state->nsoid, str); sb = sp - 8 * argc; TRACE(rinvoke, 3, ("Invoking on %#x %s a %.*s [%d] -> [%d]", obj, OIDString(h.target), ct->d.name->d.items, ct->d.name->d.data, argc, retc)); TRACE(rinvoke, 4, ("It is on node %s", NodeString(srv))); sendNVars(str, argc, (int *)sb, state->ep, state->et); state->sp = sb; inhibit_gc--; if (isLimbo(srv)) { findAndSendTo(h.target, str); } else { sendMsgTo(srv, str, h.target); } return 1; }