On 12/09/15 15:53, 杜如意 wrote: > Hi everybody, > > You know my program need other threads to process other works, it may > more than one, > > so sometimes i need to pass message to uv loop thread and hope got a > processing result, > > it's a easy way what use uv_async_send function to pass and invoke a > callback function to pass processing result, > > but you also know it will lost passing message when invoke many times > at the same time. > > i also thought about use like local-tcp connecting or pipe to control uv > loop, but you know it looks like redundant and make the code more complex. >
You could use a thread-safe queue which you put stuff into from other threads, and then process it in the loop thread on a uv_async_send's callback. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
