On Wed, Jan 25, 2017 at 9:53 AM, <[email protected]> wrote: > Hello. > > I'm playing with libuv and have this code [1]. This is, basically, just UDP > echo server which replies with "hello" on every request. > > The workflow is as follows: UDP packet arrives, in on_read callback new work > is queued via uv_queue_work() (line 138), and in this "work" uv_udp_send() > is being used to send a reply (line 92).
You can't do that, it's not thread-safe. libuv APIs are not thread-safe, unless stated otherwise. Since you are queuing the work to be run in another thread, you cannot call uv_udp_send from there. You'll need to restructure your code so you send the packet from the libuv thread. Cheers, -- /Saúl 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 https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
