chronoxor / CppServer

Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
MIT License
1.42k stars 285 forks source link

CppServer::Asio::Timer is not thread-safe #50

Open herolover opened 3 years ago

herolover commented 3 years ago

CppServer::Asio::Timer::Cancel method must be called from its io_context, otherwise there is a data race.

https://www.boost.org/doc/libs/1_75_0/doc/html/boost_asio/reference/system_timer.html#boost_asio.reference.system_timer.thread_safety

Or mark CppServer::Asio::Timer as not thread-safe.

P.S. I highly recommend to test all of your libs with thread sanitizer.