|
From: steve donovan
Sent: Tuesday, February 03, 2015 7:27 PM
>> On Tue, Feb 3, 2015 at 7:05 PM, Are Leistad
<aleistad@telia.com> wrote:
>> As we know it's possible to use lua_resume() with lua_sethook() to
get
>> cooperative timeslicing of sorts for a Lua thread, and even
implement
>> multiple threads with a Lua script. Of course it's not
particularly
>> efficient, and the execution of the global state can't be
timesliced
>> in this way.
>
> But how this is different from Lua coroutines with an appropriate
scheduler?
The first paragraph is talking about that, if I understand you correctly(?)
I even use this to great effect in an application where performance isn't
critical.
As the posting goes on to talk about, I'm thinking about a general
mechanism to cooperatively timelice the VM itself from the host environemt,
potentially by “simply” calling luaV_execute() for N instructions at a time by
using something like the example I gave ( lua_pollvm(...) ).
|