skypjack / uvw

Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!
MIT License
1.84k stars 209 forks source link

Does uvw is thread-safe? #254

Closed pengweichu closed 2 years ago

pengweichu commented 3 years ago

Hello, I'm working on a TCP/UDP client that will send mass messages to the server from numerous threads. Is the uvw thread-safe?

I see the test folder there has an example for AsyncHandle, so if use the TCPHandle rather than AsyncHandle, the uvw will work synchronously?

Thanks

skypjack commented 3 years ago

This doesn't depend on uvw, I'm sorry. Whatever the answer, it also can change any time without us noticing it. The library is just a wrapper around libuv and forwards everything to the underlying library. I strongly suggest to refer to the libuv documentation for more details.

pengweichu commented 3 years ago

This doesn't depend on uvw, I'm sorry. Whatever the answer, it also can change any time without us noticing it. The library is just a wrapper around libuv and forwards everything to the underlying library. I strongly suggest to refer to the libuv documentation for more details.

Thanks, since I have never used the libuv before, only one question if you can help: if use the TCPHandle rather than AyncHandle, then the write is Synchronous or Asynchronous?

BR

stefanofiorentino commented 3 years ago

All operations are async by default. Some of them have the Sync version (e.g., FileReq::writeSync)

skypjack commented 2 years ago

I close this since all questions have been answered and there is nothing to do in uvw. 👍