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
Branches
Tags
No related merge requests found
...@@ -89,8 +89,8 @@ ThreadLoop::start() ...@@ -89,8 +89,8 @@ ThreadLoop::start()
void void
ThreadLoop::stop() ThreadLoop::stop()
{ {
if (state_ == ThreadState::RUNNING) auto expected = ThreadState::RUNNING;
state_ = ThreadState::STOPPING; state_.compare_exchange_strong(expected, ThreadState::STOPPING);
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment