Discussion:
[libuv] uv_spawn if event loop is in another thread
Gábor Csárdi
2017-01-11 01:48:17 UTC
Permalink
Hi All,

quick question about uv_spawn and threads. If I have an event loop running
in another thread (let's call it worker thread), can I call uv_spawn from
the main thread and specify the worker thread's event loop?

I don't see anything in the docs that says that I cannot, but it would be
great to be sure...

Thanks much!
Gabor
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.
Saúl Ibarra Corretgé
2017-01-11 15:28:58 UTC
Permalink
Post by Gábor Csárdi
Hi All,
quick question about uv_spawn and threads. If I have an event loop running
in another thread (let's call it worker thread), can I call uv_spawn from
the main thread and specify the worker thread's event loop?
I don't see anything in the docs that says that I cannot, but it would be
great to be sure...
You can't. libuv is generally *not* thread-safe, unless stated
otherwise in a specific API function:
http://docs.libuv.org/en/v1.x/design.html#the-i-o-loop


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 libuv+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.
Loading...