Ejemplo n.º 1
0
Archivo: IoCoroutine.c Proyecto: jdp/io
IO_METHOD(IoCoroutine, run)
{
  /*doc Coroutine run
  Runs receiver and returns self.
  */
	IoCoroutine_rawRun(self);
	return IoCoroutine_rawResult(self);
}
Ejemplo n.º 2
0
Archivo: IoCoroutine.c Proyecto: jdp/io
void IoCoroutine_try(IoCoroutine *self, IoObject *target, IoObject *locals, IoMessage *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_rawRun(self);
}
Ejemplo n.º 3
0
Archivo: IoCoroutine.c Proyecto: jdp/io
IoObject *IoCoroutine_rawResume(IoCoroutine *self)
{
	if(DATA(self)->cid)
	{
		IoCoroutine *current = IoState_currentCoroutine(IOSTATE);
		IoState_setCurrentCoroutine_(IOSTATE, self);
		//printf("IoCoroutine resuming %p\n", (void *)self);
		Coro_switchTo_(IoCoroutine_rawCoro(current), IoCoroutine_rawCoro(self));

		//IoState_setCurrentCoroutine_(IOSTATE, current);
	}
	else
	{
		//printf("IoCoroutine_rawResume: can't resume coro that hasn't been run - so running it\n");
		IoCoroutine_rawRun(self);
	}

	return self;
}
Ejemplo n.º 4
0
IoObject *IoCoroutine_run(IoCoroutine *self, IoObject *locals, IoMessage *m)
{
	IoCoroutine_rawRun(self);
	return IoCoroutine_rawResult(self);
}