AFAIK, libuv is using non-blocking and single thread IO model. No need handle tcp connection in another thread. if you want to utilize multiple-core CPU, you can try spawn multiple libuv process instead of multiple thread to handle tcp io.
Best regards tom zhou On Mon, Jul 6, 2020 at 11:11 AM Ariel Machado <[email protected]> wrote: > Hi folks! > > I would like to know the correct way to pass the tcp handle of a > connection to another thread that will read / write this handle. > > The idea is, on the main thread, listen and accept new connections. These > connections are validated using a handshake protocol on this same thread > and if everything is ok, that connection is added to a queue that will be > processed by another thread. > > Currently in raw sockets I can simply pass the socket file descriptor > between threads, but in libuv I've been seeing examples where it uses IPC > pipes and uv_write2. > But in my case what I need to do is a inter-thread handle communication > but not an inter-process communication. > I think that the boilerplate and overhead of ipc pipes, (listen, write, > read ipc's) just to pass a handle within the same process should not be the > correct approach ... or should it? > I would like to get your feedback. > > Thank you! > > -- > You received this message because you are subscribed to the Google Groups > "libuv" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/libuv/2630712c-bc5a-4120-94c2-57966077cdd2o%40googlegroups.com > <https://groups.google.com/d/msgid/libuv/2630712c-bc5a-4120-94c2-57966077cdd2o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/libuv/CAHoM-UUa9co-844P0av%2BNXFj4bXbMwYR-57U5kzaBgr_tdePkw%40mail.gmail.com.
