lua-users home
lua-l archive

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


Rena - Do you have the patch you made on github perchance?

Daurnimator - I've have a look into that

Thanks

Chris

On Fri, Sep 19, 2014 at 11:30 PM, Daurnimator <quae@daurnimator.com> wrote:
On 19 September 2014 17:18, Rena <hyperhacker@gmail.com> wrote:
The way I dealt with threading+sockets in one case was to modify
LuaSocket to expose the `fd` field of the socket objects and to add a
`socket.fromfd()` function. Then you can pass the fd (an integer) from
one thread to another, and the receiving thread can create its own
socket object.

A better choice (architecturally) is to use SCM_RIGHTS (on linux) to pass the file descriptor from one process to another.
Sadly, I don't know of any good integrations with luasocket or lanes on this front.
In fact, the only lua related SCM_RIGHTS code around I know of is undocumented inside of ljsyscall: