List Info

Thread: Suspend/Resume from C?




Suspend/Resume from C?
user name
2006-07-07 10:10:29

Quick question - is it possible to pause/resume the whole of Io, i.e.
a function that is called from C, runs every active coro until it has
yielded, then returns to C? I don't really understand the docs/code on
this issue.

Thanks,

Pete

__._,_.___
.

__,_._,___
Suspend/Resume from C?
user name
2006-07-07 11:27:39


On Jul 7, 2006, at 3:10 AM, Peter Hull wrote:
> Quick question - is it possible to pause/resume the whole of Io, i.e.
> a function that is called from C, runs every active coro until it has
> yielded, then returns to C? I don't really understand the docs/code on
> this issue.

Hi Peter,

Yes. When you're in C, you can get a reference to the current
coroutine by calling:

IoCoroutine *currentCoro = IoState_currentCoroutine(ioState);

If you have a pointer to an IoCoroutine you'd like to resume, you can
call:

IoCoroutine_rawResume(someCoro);

To resume it. To resume the initial coroutine, you can call:

IoCoroutine_rawResume(currentCoro);

Or call resume on it on the Io side.

- Steve

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )