[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Yielding coroutines from C using coco patch
- From: Tobias Markmann <tmarkmann@...>
- Date: Sun, 18 Jan 2009 12:49:40 +0100
I'm writing an application which enables users scripts to be executed, multiple in parallel. So each script has its own lua_State. Now i want to provide those scripts a function they can call to be continued later, for example wait(60) to wait 60 seconds and then be resumed. My idea was to just yield those scripts from C and resume them after 60 seconds. That way they won't need to wait in a locking way in its own OS thread.
Though what happens when I try to execute my wait C function from Lua which is build like,
, is that i get the following error:
attempt to yield across metamethod/C-call boundary
[C]: in function 'wait'
I thought with the coro patch from luajit.org
something like this is possible. So my question is: How to yield/resume the right way from C?