Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
cpp-libs
actor-incubator
Commits
cf2eb1e4
Unverified
Commit
cf2eb1e4
authored
Jan 27, 2020
by
Dominik Charousset
Committed by
GitHub
Jan 27, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #63
Add test for multiplexer shutdown
parents
ff9dcae4
b8b6e00d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
libcaf_net/test/multiplexer.cpp
libcaf_net/test/multiplexer.cpp
+27
-0
No files found.
libcaf_net/test/multiplexer.cpp
View file @
cf2eb1e4
...
...
@@ -173,4 +173,31 @@ CAF_TEST(send and receive) {
CAF_CHECK_EQUAL
(
bob
->
receive
(),
"hello bob"
);
}
CAF_TEST
(
shutdown
)
{
std
::
mutex
m
;
std
::
condition_variable
cv
;
bool
thread_id_set
=
false
;
auto
run_mpx
=
[
&
]
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
m
);
mpx
->
set_thread_id
();
thread_id_set
=
true
;
lk
.
unlock
();
cv
.
notify_one
();
mpx
->
run
();
};
CAF_REQUIRE_EQUAL
(
mpx
->
init
(),
none
);
auto
sockets
=
unbox
(
make_stream_socket_pair
());
auto
alice
=
make_counted
<
dummy_manager
>
(
manager_count
,
sockets
.
first
,
mpx
);
auto
bob
=
make_counted
<
dummy_manager
>
(
manager_count
,
sockets
.
second
,
mpx
);
alice
->
register_reading
();
bob
->
register_reading
();
CAF_REQUIRE_EQUAL
(
mpx
->
num_socket_managers
(),
3u
);
std
::
thread
mpx_thread
{
run_mpx
};
std
::
unique_lock
<
std
::
mutex
>
lk
(
m
);
cv
.
wait
(
lk
,
[
&
]
{
return
thread_id_set
;
});
mpx
->
shutdown
();
mpx_thread
.
join
();
CAF_REQUIRE_EQUAL
(
mpx
->
num_socket_managers
(),
0u
);
}
CAF_TEST_FIXTURE_SCOPE_END
()
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