Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
folly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
folly
Commits
a2206d81
Commit
a2206d81
authored
Jun 26, 2015
by
Dave Watson
Committed by
Sara Golemon
Jun 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stop_ thread race
Summary: make it std::atomic Reviewed By: @tudor Differential Revision: D2191861
parent
9b980c75
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
folly/io/async/EventBase.cpp
folly/io/async/EventBase.cpp
+1
-2
folly/io/async/EventBase.h
folly/io/async/EventBase.h
+1
-1
No files found.
folly/io/async/EventBase.cpp
View file @
a2206d81
...
@@ -315,8 +315,7 @@ bool EventBase::loopBody(int flags) {
...
@@ -315,8 +315,7 @@ bool EventBase::loopBody(int flags) {
std
::
chrono
::
steady_clock
::
now
().
time_since_epoch
()).
count
();
std
::
chrono
::
steady_clock
::
now
().
time_since_epoch
()).
count
();
}
}
// TODO: Read stop_ atomically with an acquire barrier.
while
(
!
stop_
.
load
(
std
::
memory_order_acquire
))
{
while
(
!
stop_
)
{
++
nextLoopCnt_
;
++
nextLoopCnt_
;
// Run the before loop callbacks
// Run the before loop callbacks
...
...
folly/io/async/EventBase.h
View file @
a2206d81
...
@@ -671,7 +671,7 @@ bool runImmediatelyOrRunInEventBaseThreadAndWait(const Cob& fn);
...
@@ -671,7 +671,7 @@ bool runImmediatelyOrRunInEventBaseThreadAndWait(const Cob& fn);
// stop_ is set by terminateLoopSoon() and is used by the main loop
// stop_ is set by terminateLoopSoon() and is used by the main loop
// to determine if it should exit
// to determine if it should exit
bool
stop_
;
std
::
atomic
<
bool
>
stop_
;
// The ID of the thread running the main loop.
// The ID of the thread running the main loop.
// 0 if loop is not running.
// 0 if loop is not running.
...
...
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