[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Lua Lanes -- a new (?) concept for parallel Lua
- From: Asko Kauppi <askok@<a href="/cgi-bin/echo.cgi?dnainternet.net">...</a>>
- Date: Thu, 8 Feb 2007 08:33:44 +0200
It may be a bit early to throw this in the air (implementation at 0%)
but I'd want to know if there's any glitches in the design. Throwing
stones requested, in other words... ;)
I've long wanted to have seeming parallelism in Lua, something akin
to DBUS-kind message passing but made to be syntactically so "sweet"
it would seem native, transparent, and noncluttered in the code.
Lately, I crafted a mechanism that would make such calls seem like
regular function calls, using userdata as handles to the returned
f= lane( ...chunk-of-lua-code... )
a= f( ...args... ) -- starts chunk in a new thread
b= f( ...other-args... ) -- another thread
print( a + b ) -- first use of returned values
Only _using_ the values (any fields of 'a' or 'b') will actually pend
on their execution to become finished. No locking at the application
level is required.
What this also allows, is 'a' and 'b' to be passed further (even to
other threads) as parameters, without requiring their processing to
have finished, yet.
Is this the way _real_ multithreading should be introduced to Lua? :)