Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data race in sio_client_impl.cpp #394

Open
dfaure-kdab opened this issue Apr 5, 2023 · 0 comments
Open

Data race in sio_client_impl.cpp #394

dfaure-kdab opened this issue Apr 5, 2023 · 0 comments

Comments

@dfaure-kdab
Copy link

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....

@dfaure-kdab dfaure-kdab changed the title Many data races in sio_client_impl.cpp Data race in sio_client_impl.cpp Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants