Yes, I've already implemented this approach and it solves the issue. So in general it is the only legal way to run a task on the loop when it is initiated from other thread?
On Friday, March 6, 2015 at 12:49:07 PM UTC+3, Saúl Ibarra Corretgé wrote: > > On 03/03/15 20:34, Nicolai G. wrote: > > Hello, > > > > I use async handlers to put jobs on loop-thread (like connect, listen, > > close) , and each time I create uv_async_t, mixin my data in async->data > > field, initialize it and call a uv_async_send(). > > It seemed to work nicely, but now sometimes I get the situation wnen > > loop ends while there are active handlers. > > Guess a call to uv_async_init() not from loop thread might be the issue. > > So what is the polite way to inject your jobs on the loop thread, is > > there any standard practice? > > > > Hi, > > Indeed, uv_async_init is not thread-safe. You can use a thread-safe > queue, queue some work from any thread and use an async handle to > process the queue in its callback. > > > -- > > 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+un...@googlegroups.com <javascript:> > > <mailto:libuv+un...@googlegroups.com <javascript:>>. > > To post to this group, send email to li...@googlegroups.com > <javascript:> > > <mailto:li...@googlegroups.com <javascript:>>. > > Visit this group at http://groups.google.com/group/libuv. > > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.