lua-users home
lua-l archive

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


Hi,

> cobrien@radix.net wrote:
> We're evaluating Lua for an embedded application, so I'm sure
> to have a bunch of questions in the next few weeks.  So,
> to start things out...
> 
> Why isn't there select() in luasocket?

All TCP/IP I/O in LuaSocket is non-blocking plus all input is buffered
by the toolkit. Timeout values are provided to substitute select where
it would be called to avoid blocking. The library uses select to avoid
busy waits while performing non-blocking I/O.

The only use of select by a script would to find out which of several
sockets is ready for a given operation, thus alowing multiplexing. The
library provides poll for that, and soon multi-threading within Lua will
render this use less important.

I agree using poll will turn the multiplexing into a busy wait, while
select would block the process, but select has several idiosincrasies
and I was not willing to implement my own version of it (because of
buffered I/O, I can't just export it to Lua) and yet keep it's problems.

If there is anything you can't do with the current API, please clarify
and I will try to help.

Regards,
Diego.