> 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).