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
e140966f
Commit
e140966f
authored
Aug 25, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test_multiplexer::flush_runnables
parent
3627cdb7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
libcaf_io/src/test_multiplexer.cpp
libcaf_io/src/test_multiplexer.cpp
+19
-12
No files found.
libcaf_io/src/test_multiplexer.cpp
View file @
e140966f
...
...
@@ -243,10 +243,7 @@ void test_multiplexer::accept_connection(accept_handle hdl) {
}
void
test_multiplexer
::
read_data
(
connection_handle
hdl
)
{
// flush any pending runnables
while
(
try_exec_runnable
())
{
// nop
}
flush_runnables
();
scribe_data
&
sd
=
scribe_data_
[
hdl
];
switch
(
sd
.
recv_conf
.
first
)
{
case
receive_policy_flag
:
:
exactly
:
...
...
@@ -313,15 +310,25 @@ bool test_multiplexer::try_exec_runnable() {
}
void
test_multiplexer
::
flush_runnables
()
{
// execute runnables in bursts, pick a small size to
// minimize time in the critical section
constexpr
size_t
max_runnable_count
=
8
;
std
::
vector
<
runnable_ptr
>
runnables
;
runnables
.
reserve
(
256
);
runnables
.
reserve
(
max_runnable_count
);
// runnables can create new runnables, so we need to double-check
// that `runnables_` is empty after each burst
do
{
runnables
.
clear
();
{
// critical section
guard_type
guard
{
mx_
};
while
(
!
runnables_
.
empty
())
while
(
!
runnables_
.
empty
()
&&
runnables
.
size
()
<
max_runnable_count
)
{
runnables
.
emplace_back
(
std
::
move
(
runnables_
.
front
()));
runnables_
.
pop_front
();
}
}
for
(
auto
&
ptr
:
runnables
)
ptr
->
run
();
}
while
(
!
runnables
.
empty
());
}
void
test_multiplexer
::
dispatch_runnable
(
runnable_ptr
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