lua-users home
lua-l archive

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


Thanks Thomas for your reply.

> Le mercredi 28 mars 2018 à 07:47:33 UTC+2, Thomas Jericke <tjericke@indel.ch> a écrit :

> It is possible to add preemptive scheduling to Lua >5.2 using hooks and yields.

Can you point me out some docs, examples, tutorials about that ?

> But I would ask myself first, if you really need preemptive scheduling and in which situations.
> So my advice is, to look into a cooperative solution for your problem first.

My goal is to provide to end user the possibility to create Blockly like scripts which will be converted to Lua for execution (as Domoticz is doing).
The problems with cooperative approach is the scripts have to contains some explicite yield() which, de facto, impact the design of scripts themself, something I would like to avoid.

Using real preemptive scheduling approach is an easiest concept :
* each task is focusing only on its jobs
* their scripts doesn't have to take care of what happening outside their own duty (shared objects access arbitration is already done at C side).

The other added value is a badly written script can't block everything (bad remembering of m$-win 3.xx era).

Bye

Laurent