On Sat, Feb 14, 2009 at 10:56 PM, Alexander Gladysh <
agladysh@gmail.com> wrote:
>>> local coro -- A forward declaration
>>> coro = coroutine.create(function()
>>> ENGINE.call_me_later(function() assert(coroutine.resume(coro)) end)
>>> coroutine.yield()
>>> end)
>>> assert(coroutine.resume(coro))
>>>
>>> When I run it, coroutine.resume() inside the callback fails with
>>> message "cannot resume running coroutine". Coroutine status is
>>> "running" and coroutine.running() points to the coroutine as well.
>>
>> It seems like ENGINE.call_me_later() is executing the function that it is
>> being passed before returning, so it gets run in the context of the coro
>> coroutine itself, which obviously cannot be resumed because it is not
>> suspended. I freely admit I may be misunderstanding something here though.
>
> No, I just double checked by adding extensive logging, callback gets
> called after whole main chunk is executed.