|
I propose to discuss the
possibility to extend language and bytecode for transactions and
true multithreading. To do this we need four things:
Like following example: transaction --[[ here VM store stack and code position in current exectuton context AND call some impelmentation specific C-function declared like lua_lock --]] local someVar = 1 for i=1,10 do someVar = someVar + someJob() if someVar > 9000 then rollback -- here VM reverted to saved position AND call some another C-function end end commit --[[ here VM call third C-function and ether discard stored position or work exactly as 'rollback' --]] Theese primitives allow to implement modern lock-free multithreading easily so each "real" thread own his 'personal' lua_State and cheaply send and recieve objects to others. Best regards, Sim. |