Ejemplo n.º 1
0
IoCoroutine *IoCoroutine_newWithTry(void *state,
									IoObject *target,
									IoObject *locals,
									IoMessage *message)
{
	IoCoroutine *self = IoCoroutine_new(state);

	//IoCoroutine_try(self, target, locals, message);
	IoCoroutine *currentCoro = (IoCoroutine *)IoState_currentCoroutine((IoState *)IOSTATE);
	IoCoroutine_rawSetRunTarget_(self, target);
	IoCoroutine_rawSetRunLocals_(self, locals);
	IoCoroutine_rawSetRunMessage_(self, message);
	IoCoroutine_rawSetParentCoroutine_(self, currentCoro);
	IoCoroutine *self = (IoCoroutine *)context;

	IoObject *result;

	IoState_setCurrentCoroutine_(IOSTATE, self);
	//printf("%p-%p start\n", (void *)self, (void *)DATA(self)->cid);
	result = IoMessage_locals_performOn_(IOSTATE->mainMessage, self, self);

	IoCoroutine_rawSetResult_(self, result);
	IoCoroutine_rawReturnToParent(self);

    // return from newwithTry
    return self;
}
Ejemplo n.º 2
0
Archivo: IoCoroutine.c Proyecto: jdp/io
void IoCoroutine_coroStart(void *context) // Called by Coro_Start()
{
	IoCoroutine *self = (IoCoroutine *)context;
	IoObject *result;

	IoState_setCurrentCoroutine_(IOSTATE, self);
	//printf("%p-%p start\n", (void *)self, (void *)DATA(self)->cid);
	result = IoMessage_locals_performOn_(IOSTATE->mainMessage, self, self);

	IoCoroutine_rawSetResult_(self, result);
	IoCoroutine_rawReturnToParent(self);
}
Ejemplo n.º 3
0
Archivo: IoCoroutine.c Proyecto: jdp/io
void IoCoroutine_raiseError(IoCoroutine *self, IoSymbol *description, IoMessage *m)
{
	IoObject *e = IoObject_rawGetSlot_(self, IOSYMBOL("Exception"));

	if (e)
	{
		e = IOCLONE(e);
		IoObject_setSlot_to_(e, IOSYMBOL("error"), description);
		if (m) IoObject_setSlot_to_(e, IOSYMBOL("caughtMessage"), m);
		IoObject_setSlot_to_(e, IOSYMBOL("coroutine"), self);
		IoCoroutine_rawSetException_(self, e);
	}

	IoCoroutine_rawReturnToParent(self);
}