lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 06.03.2015 um 12:00 schröbte Thierry FOURNIER:
Hello,

Hi!


I try to implement an execution timeout controller and a forced yield
to improve reactivity of my scheduler. I use the debug hook with an
instruction counter. In my hook function I try to run a yield.

This is useful to executing a forced yield and give the hand to my
main scheduler. This permits than a quite long Lua code doesn't block
my event driven process.

Sometimes the execution state is not yieldable. I sew the Lua code, and
this information seems to be contained in the "nny" variable. The C api
cannot give me the access to this variable.

It have a mean from the C api to know if I can execute a yield ?

Lua 5.3 has `lua_isyieldable`[1] (or `coroutine.isyieldable`[2] on the Lua side). For previous Lua versions you are out of luck.


Thank
Thierry


Philipp

  [1]: http://www.lua.org/manual/5.3/manual.html#lua_isyieldable
  [2]: http://www.lua.org/manual/5.3/manual.html#pdf-coroutine.isyieldable