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
5d2c7089
Commit
5d2c7089
authored
Jan 22, 2020
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Synchronize test
parent
f6f0b989
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
libcaf_net/test/multiplexer.cpp
libcaf_net/test/multiplexer.cpp
+11
-4
No files found.
libcaf_net/test/multiplexer.cpp
View file @
5d2c7089
...
@@ -174,20 +174,27 @@ CAF_TEST(send and receive) {
...
@@ -174,20 +174,27 @@ CAF_TEST(send and receive) {
}
}
CAF_TEST
(
shutdown
)
{
CAF_TEST
(
shutdown
)
{
auto
run_mpx
=
[
=
]
{
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
();
mpx
->
set_thread_id
();
thread_id_set
=
true
;
lk
.
unlock
();
cv
.
notify_one
();
mpx
->
run
();
mpx
->
run
();
};
};
CAF_REQUIRE_EQUAL
(
mpx
->
init
(),
none
);
CAF_REQUIRE_EQUAL
(
mpx
->
init
(),
none
);
std
::
thread
mpx_thread
{
run_mpx
};
auto
sockets
=
unbox
(
make_stream_socket_pair
());
auto
sockets
=
unbox
(
make_stream_socket_pair
());
auto
alice
=
make_counted
<
dummy_manager
>
(
manager_count
,
sockets
.
first
,
mpx
);
auto
alice
=
make_counted
<
dummy_manager
>
(
manager_count
,
sockets
.
first
,
mpx
);
auto
bob
=
make_counted
<
dummy_manager
>
(
manager_count
,
sockets
.
second
,
mpx
);
auto
bob
=
make_counted
<
dummy_manager
>
(
manager_count
,
sockets
.
second
,
mpx
);
alice
->
register_reading
();
alice
->
register_reading
();
bob
->
register_reading
();
bob
->
register_reading
();
while
(
mpx
->
num_socket_managers
()
!=
3
)
;
// nop
CAF_REQUIRE_EQUAL
(
mpx
->
num_socket_managers
(),
3u
);
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
->
shutdown
();
mpx_thread
.
join
();
mpx_thread
.
join
();
CAF_REQUIRE_EQUAL
(
mpx
->
num_socket_managers
(),
0u
);
CAF_REQUIRE_EQUAL
(
mpx
->
num_socket_managers
(),
0u
);
...
...
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