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
15a0b49f
Commit
15a0b49f
authored
Feb 20, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ordering issue in message_queue::push
parent
37d0d5bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
libcaf_io/src/message_queue.cpp
libcaf_io/src/message_queue.cpp
+8
-12
No files found.
libcaf_io/src/message_queue.cpp
View file @
15a0b49f
...
@@ -40,24 +40,20 @@ void message_queue::push(execution_unit* ctx, uint64_t id,
...
@@ -40,24 +40,20 @@ void message_queue::push(execution_unit* ctx, uint64_t id,
// Dispatch current head.
// Dispatch current head.
if
(
receiver
!=
nullptr
)
if
(
receiver
!=
nullptr
)
receiver
->
enqueue
(
std
::
move
(
content
),
ctx
);
receiver
->
enqueue
(
std
::
move
(
content
),
ctx
);
auto
next
=
id
+
1
;
// Check whether we can deliver more.
// Check whether we can deliver more.
if
(
first
==
last
||
first
->
id
!=
next
_undelivered
+
1
)
{
if
(
first
==
last
||
first
->
id
!=
next
)
{
++
next_undelivered
;
next_undelivered
=
next
;
CAF_ASSERT
(
next_undelivered
<=
next_id
);
CAF_ASSERT
(
next_undelivered
<=
next_id
);
return
;
return
;
}
}
// We look for the last element that we cannot ship right away.
// Deliver everything until reaching a non-consecutive ID or the end.
auto
pred
=
[](
const
actor_msg
&
x
,
const
actor_msg
&
y
)
{
auto
i
=
first
;
return
x
.
id
+
1
>
y
.
id
;
for
(;
i
!=
last
&&
i
->
id
==
next
;
++
i
,
++
next
)
};
auto
last_hit
=
std
::
adjacent_find
(
first
,
last
,
pred
);
CAF_ASSERT
(
last_hit
!=
first
);
auto
new_last
=
last_hit
==
last
?
last
:
last_hit
+
1
;
for
(
auto
i
=
first
;
i
!=
new_last
;
++
i
)
if
(
i
->
receiver
!=
nullptr
)
if
(
i
->
receiver
!=
nullptr
)
i
->
receiver
->
enqueue
(
std
::
move
(
i
->
content
),
ctx
);
i
->
receiver
->
enqueue
(
std
::
move
(
i
->
content
),
ctx
);
next_undelivered
+=
static_cast
<
size_t
>
(
std
::
distance
(
first
,
new_last
))
+
1
;
next_undelivered
=
next
;
pending
.
erase
(
first
,
new_last
);
pending
.
erase
(
first
,
i
);
CAF_ASSERT
(
next_undelivered
<=
next_id
);
CAF_ASSERT
(
next_undelivered
<=
next_id
);
return
;
return
;
}
}
...
...
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