« Return to Thread: Is it possible to yield/resume a io cothread as part of an extension?

Re: Is it possible to yield/resume a io cothread as part of an extension?

by Steve Dekorte :: Rate this Message:

Reply to Author | View in Thread


On 2009-04-20, at 3:14 PM, daveb13579 wrote:
> I'm interested in replacing Lua in a program I maintain, for various  
> reasons, so I'm in the market for a language that supports embedding  
> in the following way (as lua does..):
>
> - I would like to register a function which suspends the IOState  
> interpretation.   For example, I'd like to embed IO in a program  
> that does a lot of message passing;  I want a "read_message()"  
> function accessible in IO that returns control to the C code (the  
> caller of IoState_doCString_)

This is how normal Io bindings work. Io uses the C stack so it can  
easily integrate with C libs.

> - The C implementation of read_message must arrange to call  
> IOState_resume when a message becomes available (with possible  
> cancellation support, i guess)

It would be easier if you can return to Io instead. But if you need to  
pause and resume Io coroutines, you can do that from C.

> - There probably needs to be a way to get notification when the  
> IOState terminates.

There is an IoState callback for this.




 « Return to Thread: Is it possible to yield/resume a io cothread as part of an extension?