lua-users home
lua-l archive

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

On Thu, Dec 11, 2014 at 6:31 PM, Sean Conner <> wrote:

  You don't need to set the socket to non-blocking if you use select just
for reading (and I just checked our codebase at work---I don't set any of
the sockets to nonblocking).

In our case we use it also to check if it is possible to write into sockets.  
  All select() does is indicate when a file
descriptor (in your case, a network socket) has received data (ready for
reading), can write data without blocking (ready for writing [1]) or an
error happened.

> Isn't there any clean way to have the coroutine associated with the socket
> to somehow keep running in background without being continuously
> interrupted ?

  Lua coroutines are not threads as they don't run autonomously but need to
be explicitely scheduled (or resumed).  I have sample Lua code that does
this, but it uses my own network [2] and select [3] modules, not luasocket
[4].  If you are interested, I can send the code which may help you with
your issue.

I am, feel free to share it with me. I'll take a look for sure.