lua-users home
lua-l archive

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


Friday, April 28, 2006, 7:10:56 PM, Diego Nehab wrote:

>> I am sure you will be requoted many times. IMHO the way around the
>> thread problem is have the OS handle the threading for you. IO completion
>> ports and overlapped IO do this on Win32. For once MS almost got it right.
>> There is, I believe, a few *nix implementations of IOCPs.
>> Anyways, the IOCP model should not be tough to emulate on *nix and
>> it solves a *lot* of thread/mutex nightmares (tremble/shake).

> I agree with that, and this is the direction we will take in
> writing LuaSocket 3.0. We will try to come up with a nice
> common interface to AIO what will work both on *nix and
> Win32.

> However, there will always be someone asking: "Why doesn't
> Lua have multi-threading support?"

You can get the best of both worlds by providing a simple coroutine
scheduler, and make versions of all the AIO primitives that block the
calling coroutine, and schedule a waiting coroutine by dequeuing the
IOCP.

e

-- 
Doug Currie
Londonderry, NH