[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LibEvent binding to Lua? Mix w/ HelperThreads?
- From: Doug Currie <doug.currie@...>
- Date: Tue, 4 Apr 2006 17:47:46 -0400
Tuesday, April 4, 2006, 11:24:39 AM, Javier Guerra wrote:
> it seems we all mostly agree on how the Lua API should look, but on the C side
> they're all too different. Any serious proposal should specify a stable C
> API to write new libraries and make them work with the same Lua scheduler.
But does it need to be the *same* C API on all platforms? I don't see
why since, assuming I/O is involved, there will be separate
implementations for each platform anyway.
If the C API is the same on all platforms, it will need to be very
abstract, and very minimal.
Here's an example: HelperThreads has a queue-peek API. This is not
possible with IOCP on Windows (at least, I don't know how to do it
without polling and re-enqueuing which would break the FIFO
semantics).
Another example: IOCP AIO system I/O functions initiate I/O and
enqueue in the same system call. In HelperThreads this is two
operations.
On the other hand, there is no impediment to using threads with IOCP.
There is a enqueue-completion-status C API for IOCP, so a user thread
can interact with the same queue used by system i/o completion. So it
would be possible to build a Win32 library that used AIO system calls
where available, and user threads where not, while maintaining the
illusion of all AIO (just as HelperThreads does but with a stripped
down API).
Regards,
e
--
Doug Currie
Londonderry, NH