Commit f8bb66b4 authored by Max Kellermann's avatar Max Kellermann

event/Loop: use std::atomic_bool for the "quit" variable

Fixes thread sanitizer warnings.
parent 5d6a8b38
......@@ -25,7 +25,7 @@
#include "util/ScopeExit.hxx"
EventLoop::EventLoop(ThreadId _thread)
:SocketMonitor(*this), thread(_thread)
:SocketMonitor(*this), quit(false), thread(_thread)
{
SocketMonitor::Open(SocketDescriptor(wake_fd.Get()));
}
......@@ -39,10 +39,9 @@ EventLoop::~EventLoop()
void
EventLoop::Break()
{
if (quit)
if (quit.exchange(true))
return;
quit = true;
wake_fd.Write();
}
......
......@@ -36,6 +36,7 @@
#include <boost/intrusive/list.hpp>
#include <chrono>
#include <atomic>
#include <assert.h>
......@@ -85,7 +86,7 @@ class EventLoop final : SocketMonitor
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
bool quit = false;
std::atomic_bool quit;
/**
* True when the object has been modified and another check is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment