lua-users home
lua-l archive

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


On Tuesday 11 January 2005 10:19 pm, Diego Nehab wrote:
> Hi,
>
> > i tried to do it with coroutines too (more lightweight), but luaSocket
> > doesn't seem to have a truly nonblocking mode.  and i do like it's
> > 'line mode'.
>
> Care to explain? :)

sure; after doing a select(), i can know that a given socket has some data 
available, so i do a receive();  but i can't tell the library to read ONLY 
what's available and return immediately.  it'll always wait until it has all 
the data asked, or until a timeout.  a timeout of 0 is 'forever' and not 
'immediately'.  (maybe -1? haven't tried it)

and the line mode receive is very nice for text based protocols, but if i use 
timeouts, i have to join the partial returns anyway.

in the end, this, and because i want the pluggin handler functions to be as 
easy to write as possible, i settled on using threads instead of coroutines.

BTW, the LuaThreads package seems to be outdated, i had to tweak it to get to 
compile with Lua5.0.2, is there a newer version? or is it deprecated?

-- 
Javier

Attachment: pgpHypuRh7t9X.pgp
Description: PGP signature