On 08/26/2016 10:34 PM, Tigran Bayburtsyan wrote: > Just wanted to give some update. > It looks strange but I've just changed loop pointer in socket and it > started working from another thread. > > I'm doing in this way > > 1. Running 4 loops for reading data and 1 loop for accepting connection > 2. Accepting connection, authenticating, stopping read process and > changing loop pointer to one of the 4 other loops > 3. Starting read process > > I've surprised but it works very well, even on data load. > Am I doing wrong, by changing loop pointer manually ? >
That's a terrible idea. You shouldn't change the loop pointer of any handle, it's considered "readonly" http://docs.libuv.org/en/v1.x/handle.html#c.uv_handle_t.loop Now, this is C so you're allowed to shoot yourself in the foot. I can't prevent you from doing it, but note that when you application blows up you voided the warranty :-) As I mentioned earlier: use uv_write2, that's why it exists, to send a handle over a pipe. All you need is to have 4 pipes connecting the "main" loop with each of the workers, and send the accepted connection (or read a bit, send it later, it doesn't matter) to any of the workers. Cheers, -- Saúl Ibarra Corretgé 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.
signature.asc
Description: OpenPGP digital signature