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
05c2a8c2
Commit
05c2a8c2
authored
Jul 04, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce code duplication in I/O DSL
parent
1d93df35
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
libcaf_test/caf/test/io_dsl.hpp
libcaf_test/caf/test/io_dsl.hpp
+15
-9
No files found.
libcaf_test/caf/test/io_dsl.hpp
View file @
05c2a8c2
...
@@ -158,20 +158,18 @@ public:
...
@@ -158,20 +158,18 @@ public:
// Convenience function for transmitting all "network" traffic.
// Convenience function for transmitting all "network" traffic.
void
network_traffic
()
{
void
network_traffic
()
{
while
(
earth
.
mpx
.
try_exec_runnable
()
||
mars
.
mpx
.
try_exec_runnable
()
run_exhaustively
([](
planet_type
*
x
)
{
||
earth
.
mpx
.
read_data
()
||
mars
.
mpx
.
read_data
())
{
return
x
->
mpx
.
try_exec_runnable
()
||
x
->
mpx
.
read_data
();
// rince and repeat
});
}
}
}
// Convenience function for transmitting all "network" traffic and running
// Convenience function for transmitting all "network" traffic and running
// all executables on earth and mars.
// all executables on earth and mars.
void
exec_all
()
{
void
exec_all
()
{
while
(
earth
.
mpx
.
try_exec_runnable
()
||
mars
.
mpx
.
try_exec_runnable
()
run_exhaustively
([](
planet_type
*
x
)
{
||
earth
.
mpx
.
read_data
()
||
mars
.
mpx
.
read_data
()
return
x
->
mpx
.
try_exec_runnable
()
||
x
->
mpx
.
read_data
()
||
earth
.
sched
.
run_once
()
||
mars
.
sched
.
run_once
())
{
||
x
->
sched
.
run_once
();
// rince and repeat
});
}
}
}
void
prepare_connection
(
planet_type
&
server
,
planet_type
&
client
,
void
prepare_connection
(
planet_type
&
server
,
planet_type
&
client
,
...
@@ -179,6 +177,14 @@ public:
...
@@ -179,6 +177,14 @@ public:
server
.
mpx
.
prepare_connection
(
server
.
acc
,
server
.
conn
,
client
.
mpx
,
server
.
mpx
.
prepare_connection
(
server
.
acc
,
server
.
conn
,
client
.
mpx
,
std
::
move
(
host
),
port
,
client
.
conn
);
std
::
move
(
host
),
port
,
client
.
conn
);
}
}
private:
template
<
class
F
>
void
run_exhaustively
(
F
f
)
{
planet_type
*
planets
[]
=
{
&
earth
,
&
mars
};
while
(
std
::
any_of
(
std
::
begin
(
planets
),
std
::
end
(
planets
),
f
))
;
// rince and repeat
}
};
};
/// Binds `test_coordinator_fixture<Config>` to `point_to_point_fixture`.
/// Binds `test_coordinator_fixture<Config>` to `point_to_point_fixture`.
...
...
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