[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How to swap coroutine ?
- From: Gaspard Bucher <gaspard@...>
- Date: Mon, 12 Sep 2011 19:14:21 +0200
Hi list !
I would like to create a coroutine and then continue execution in the coroutine so that the original calling code can yield.
Usage:
-- ...
co = coroutine.create(function()
-- A
-- co == main running code (B)
scheduler:run()
end)
-- transform running thread into a coroutine and continue execution in "A"
-- B
coroutine.swap(co)
Is this possible ?
Gaspard