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

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

by daveb13579 :: Rate this Message:

Reply to Author | View in Thread

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_)

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

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

It seems likely that IO supports this-- but the docs on extensions are too rudimentary to figure it out.  I decided not to wade into the implementation of IO just yet...

A pointer to an example (if it can be done) would be really great!

thanks,
dave


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