Thanks for replay, almost same thing is written in documentation and couple of multiprocess examples. Can you share with me super super super super simple example of code ? Thanks
On Friday, August 26, 2016 at 4:46:30 PM UTC+4, Saúl Ibarra Corretgé wrote: > > On 26/08/16 13:43, Tigran Bayburtsyan wrote: > > Hi All. > > I'm writing multithreaded application based on libuv and now I'm in > trouble. > > I can't understand how to accept connection from one thread, read some > > validation data from it and then transfer that connection to another > > thread for reading remaining data. > > I found some examples for multiprocess communication using UV_PIPE-s, > > but in all that examples master process just sending notification to > > accept connection. > > > > What I need is accept connection from one thread and then without > > closing connection start reading from another thread. > > Is there any solution for that ? even if I need to hack something. > > > > | > > > > // Accept connection > > if(uv_accept(server,(uv_stream_t*)client)==0){ > > > > .................. > > .................. > > > > // how can I call uv_read_start for a different loop ??? > > intr =uv_read_start((uv_stream_t*)client,alloc_cb,on_read); > > if(r){ > > uv_close((uv_handle_t*)client,close_client); > > return; > > } > > > > }else{ > > uv_close((uv_handle_t*)client,close_client); > > } > > > > | > > > > You need to send the handle from one loop to another, just in the > multi-process examples you saw. A handle it tied to a given loop, so if > you want to use from a different one, you must use uv_write2 and send > the handle over a pipe to the loop running on the other thread. > > > Cheers, > > -- > Saúl Ibarra Corretgé > http://bettercallsaghul.com > -- 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 libuv+unsubscr...@googlegroups.com. To post to this group, send email to libuv@googlegroups.com. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.