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
e651babd
Commit
e651babd
authored
Sep 16, 2018
by
Luca Boccassi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_proxy_hwm uses an bool across threads
Solution: use atomics to avoid issues on non-x86 architectures
parent
02019d9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
test_proxy_hwm.cpp
tests/test_proxy_hwm.cpp
+6
-5
No files found.
tests/test_proxy_hwm.cpp
View file @
e651babd
...
...
@@ -65,7 +65,7 @@ typedef struct
const
char
*
backend_endpoint
;
const
char
*
control_endpoint
;
bool
subscriber_received_all
;
void
*
subscriber_received_all
;
}
proxy_hwm_cfg_t
;
static
void
lower_hwm
(
void
*
skt
)
...
...
@@ -184,8 +184,7 @@ static void subscriber_thread_main (void *pvoid)
// INFORM THAT WE COMPLETED:
cfg
->
subscriber_received_all
=
true
;
zmq_atomic_counter_inc
(
cfg
->
subscriber_received_all
);
// CLEANUP
...
...
@@ -304,7 +303,7 @@ static void proxy_stats_asker_thread_main (void *pvoid)
// Start!
while
(
!
cfg
->
subscriber_received_all
)
{
while
(
!
zmq_atomic_counter_value
(
cfg
->
subscriber_received_all
)
)
{
#ifdef ZMQ_BUILD_DRAFT_API
check_proxy_stats
(
control_req
);
#endif
...
...
@@ -399,7 +398,7 @@ int main (void)
cfg
.
frontend_endpoint
=
"inproc://frontend"
;
cfg
.
backend_endpoint
=
"inproc://backend"
;
cfg
.
control_endpoint
=
"inproc://ctrl"
;
cfg
.
subscriber_received_all
=
false
;
cfg
.
subscriber_received_all
=
zmq_atomic_counter_new
()
;
void
*
proxy
=
zmq_threadstart
(
&
proxy_thread_main
,
(
void
*
)
&
cfg
);
assert
(
proxy
!=
0
);
...
...
@@ -422,5 +421,7 @@ int main (void)
int
rc
=
zmq_ctx_term
(
context
);
assert
(
rc
==
0
);
zmq_atomic_counter_destroy
(
&
cfg
.
subscriber_received_all
);
return
0
;
}
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