|
On 19 September 2014 17:18, Rena <hyperhacker@gmail.com> wrote:LuaSocket to expose the `fd` field of the socket objects and to add aThe way I dealt with threading+sockets in one case was to modify
`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: