Skip to content
Snippets Groups Projects
Commit 56dd1c2c authored by Adrien Béraud's avatar Adrien Béraud
Browse files

ThreadLoop: change state atomically

Change-Id: I9909742daa4d2f13aa85f8f66796f6cb8bf8448d
parent a8700f2f
No related branches found
No related tags found
No related merge requests found
......@@ -89,8 +89,8 @@ ThreadLoop::start()
void
ThreadLoop::stop()
{
if (state_ == ThreadState::RUNNING)
state_ = ThreadState::STOPPING;
auto expected = ThreadState::RUNNING;
state_.compare_exchange_strong(expected, ThreadState::STOPPING);
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment