Skip to content
Snippets Groups Projects
Commit 20c6d705 authored by Philippe Gorley's avatar Philippe Gorley
Browse files

thread: add way to notify waiting thread of changes

Don't notify on stop.

Change-Id: Ic3eead63c4756d1790da1ba7223a431cbc238232
parent daa247f6
Branches
No related tags found
No related merge requests found
...@@ -142,7 +142,6 @@ void ...@@ -142,7 +142,6 @@ void
InterruptedThreadLoop::stop() InterruptedThreadLoop::stop()
{ {
ThreadLoop::stop(); ThreadLoop::stop();
std::lock_guard<std::mutex> lk(mutex_);
cv_.notify_one(); cv_.notify_one();
} }
} // namespace ring } // namespace ring
...@@ -86,6 +86,11 @@ public: ...@@ -86,6 +86,11 @@ public:
void stop() override; void stop() override;
void interrupt() noexcept
{
cv_.notify_one();
}
template <typename Rep, typename Period> template <typename Rep, typename Period>
void void
wait_for(const std::chrono::duration<Rep, Period>& rel_time) wait_for(const std::chrono::duration<Rep, Period>& rel_time)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment