Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
1f50bdb2
Commit
1f50bdb2
authored
Dec 22, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/Loop: use std::atomic_bool for the "quit" variable
Fixes thread sanitizer warnings.
parent
2eef4e67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
Loop.cxx
src/event/Loop.cxx
+4
-2
Loop.hxx
src/event/Loop.hxx
+2
-1
No files found.
src/event/Loop.cxx
View file @
1f50bdb2
...
...
@@ -27,7 +27,7 @@
#include <algorithm>
EventLoop
::
EventLoop
()
:
SocketMonitor
(
*
this
)
:
SocketMonitor
(
*
this
)
,
quit
(
false
)
{
SocketMonitor
::
Open
(
wake_fd
.
Get
());
SocketMonitor
::
Schedule
(
SocketMonitor
::
READ
);
...
...
@@ -46,7 +46,9 @@ EventLoop::~EventLoop()
void
EventLoop
::
Break
()
{
quit
=
true
;
if
(
quit
.
exchange
(
true
))
return
;
wake_fd
.
Write
();
}
...
...
src/event/Loop.hxx
View file @
1f50bdb2
...
...
@@ -30,6 +30,7 @@
#include "SocketMonitor.hxx"
#include <chrono>
#include <atomic>
#include <list>
#include <set>
...
...
@@ -82,7 +83,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment