Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
7755e88b
Commit
7755e88b
authored
Sep 12, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix peek_all ordering bug
parent
3e8817f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
libcaf_core/caf/detail/single_reader_queue.hpp
libcaf_core/caf/detail/single_reader_queue.hpp
+20
-1
No files found.
libcaf_core/caf/detail/single_reader_queue.hpp
View file @
7755e88b
...
@@ -181,7 +181,26 @@ public:
...
@@ -181,7 +181,26 @@ public:
for
(
auto
&
range
:
ranges
)
for
(
auto
&
range
:
ranges
)
for
(
auto
i
=
range
.
first
;
i
!=
range
.
second
;
++
i
)
for
(
auto
i
=
range
.
first
;
i
!=
range
.
second
;
++
i
)
fun
(
*
i
);
fun
(
*
i
);
fetch_new_data
();
// Fetch new data if needed
if
(
head_
==
nullptr
)
{
fetch_new_data
();
}
else
if
(
!
is_dummy
(
stack_
.
load
()))
{
// Calling fetch_new_data() iterates the stack and prepends messages via
// head_. This would cause reordering of messages when traversing via
// peek_all. We hence store the current state of the singly-linked list
// pointed to by head_ and then reset the list before calling
// fetch_new_data. Finally, we prepend the old list in order to get a
// consistent view.
auto
old_head
=
head_
;
head_
=
nullptr
;
auto
tail
=
old_head
;
while
(
tail
->
next
!=
nullptr
)
tail
=
tail
->
next
;
// This gets new data from the stack and rewrite head_.
fetch_new_data
();
tail
->
next
=
head_
;
head_
=
old_head
;
}
auto
ptr
=
head_
;
auto
ptr
=
head_
;
while
(
ptr
)
{
while
(
ptr
)
{
fun
(
*
ptr
);
fun
(
*
ptr
);
...
...
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