lua-users home
lua-l archive

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


On Friday 21 January 2005 05:42, skaller wrote:
> Yup, but select() and poll() aren't scalable.
> Event based notification is O(1). I saw some talk
> of a signal based system for Linux
exercising some care, you may use fcntl(F_SETSIG..)

> It's very nice the Lua system *itself* is event based,
> and therefore is scalable, but unfortunate that
> it's based on a C function that isn't.
for the user it does not matter at all whether the implementation
is based on select, SIGIO or winsock-style notifications
(which, for that matter, are not such a bad interface).
You just pick the best your particluar OS gives, no?

> Note that using poll() or select() there is no need
> to do non-blocking I/O -- since you know which sockets
> have data to read you can do a blocking read, and predict
> it won't block .. :)
With winsock notifications, sockets are always nonblocking,
and since notifications by their very nature are edge-triggered,
not level-triggered like select, you may have to do as much
IO as possible, not only the single guaranteed non-blocking call,
before you receive a new notification. This is winsock write
behaviour and may or may not be similar for SIGIO semantics.
It's not only the most portable approach, it's also efficient and
natural for a coroutine to write as long as possible and yield
on EAGAIN.

> OSX looks interesting -- nice desktop for the
> illiterate, unix underneath for us nerds .. :)
but don't expect their pthreads to be ready for prime time


cheers