The class client_impl creates a secondary thread called m_network_thread which runs run_loop().
From run_loop(), the callbacks such as on_close() are being called.
on_close() has code such as m_con_state = con_closed;
which is a data race with all the accesses to m_con_state from the main thread, such as if(m_con_state == con_closing||m_con_state == con_closed) in client_impl::connect.
This needs mutex protection, or usage of an atomic.
This makes me wonder how many other member variables are victims of data races in this class....
The class
client_impl
creates a secondary thread calledm_network_thread
which runsrun_loop()
. Fromrun_loop()
, the callbacks such ason_close()
are being called.on_close()
has code such asm_con_state = con_closed;
which is a data race with all the accesses tom_con_state
from the main thread, such asif(m_con_state == con_closing||m_con_state == con_closed)
inclient_impl::connect
. This needs mutex protection, or usage of an atomic.This makes me wonder how many other member variables are victims of data races in this class....