lua-users home
lua-l archive

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


Monday, April 3, 2006, 1:12:21 AM, Diego Nehab wrote:

> Would it make sense to try to replicate the libevent API, but based on
> HANDLEs, or should we write something completely new?

Lua uses C Library (FILE *) handles. There is a means of converting
these to HANDLEs on Windows, e.g., see
http://www.codeproject.com/file/handles.asp?df=100&forumid=2073&exp=0&select=429628
but for use with IOCP the HANDLEs have to be opened with
FILE_FLAG_OVERLAPPED; see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createiocompletionport.asp
> You must specify the FILE_FLAG_OVERLAPPED flag when using the
> CreateFile function to obtain the handle.
and the Win32 CRT doesn't open files this way.

> We would also have to adapt Lua's file I/O functions and LuaSocket
> functions to integrate well with this abstraction layer.

It seems to me that trying to simultaneously provide Lua stdlib
semantics along with AIO semantics on both Windows and Linux will be a
huge task.

Javier's HelperThreads is an interesting compromise; it retains Lua
stdlib and inter-operation by providing a separate scheduler and i/o
functions. It finesses non-blocking i/o by using threads.

IOCP on windows and libevent on Linux could provide better
performance. But it is not clear to me what you mean by "integrating
well" with Lua's and LuaSocket's I/O functions, since they were not
written for AIO.

Regards,

e

-- 
Doug Currie
Londonderry, NH