Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
72763708
Commit
72763708
authored
Apr 26, 2020
by
Luca Boccassi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_shutdown_stress_tipc fails sometimes
Solution: create socket in the same thread where it is used
parent
b56195e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
test_shutdown_stress_tipc.cpp
tests/test_shutdown_stress_tipc.cpp
+5
-6
No files found.
tests/test_shutdown_stress_tipc.cpp
View file @
72763708
...
@@ -43,12 +43,13 @@ void tearDown ()
...
@@ -43,12 +43,13 @@ void tearDown ()
#define THREAD_COUNT 100
#define THREAD_COUNT 100
extern
"C"
{
extern
"C"
{
static
void
*
worker
(
void
*
s_
)
static
void
*
worker
(
void
*
ctx
)
{
{
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
s_
,
"tipc://{5560,0}@0.0.0"
));
void
*
s
=
zmq_socket
(
ctx
,
ZMQ_SUB
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
s
,
"tipc://{5560,0}@0.0.0"
));
// Start closing the socket while the connecting process is underway.
// Start closing the socket while the connecting process is underway.
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_close
(
s
_
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_close
(
s
));
return
NULL
;
return
NULL
;
}
}
...
@@ -57,7 +58,6 @@ static void *worker (void *s_)
...
@@ -57,7 +58,6 @@ static void *worker (void *s_)
void
test_shutdown_stress_tipc
()
void
test_shutdown_stress_tipc
()
{
{
void
*
s1
;
void
*
s1
;
void
*
s2
;
int
i
;
int
i
;
int
j
;
int
j
;
pthread_t
threads
[
THREAD_COUNT
];
pthread_t
threads
[
THREAD_COUNT
];
...
@@ -72,9 +72,8 @@ void test_shutdown_stress_tipc ()
...
@@ -72,9 +72,8 @@ void test_shutdown_stress_tipc ()
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
s1
,
"tipc://{5560,0,0}"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
s1
,
"tipc://{5560,0,0}"
));
for
(
i
=
0
;
i
!=
THREAD_COUNT
;
i
++
)
{
for
(
i
=
0
;
i
!=
THREAD_COUNT
;
i
++
)
{
s2
=
zmq_socket
(
get_test_context
(),
ZMQ_SUB
);
TEST_ASSERT_SUCCESS_RAW_ERRNO
(
TEST_ASSERT_SUCCESS_RAW_ERRNO
(
pthread_create
(
&
threads
[
i
],
NULL
,
worker
,
s2
));
pthread_create
(
&
threads
[
i
],
NULL
,
worker
,
get_test_context
()
));
}
}
for
(
i
=
0
;
i
!=
THREAD_COUNT
;
i
++
)
{
for
(
i
=
0
;
i
!=
THREAD_COUNT
;
i
++
)
{
...
...
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