Skip to content

Commit 44a66e2

Browse files
committed
threads: fix WAIT_SYNC_INIT with a zero count
WAIT_SYNC_INIT(sync,0); WAIT_SYNC_RELEASE(sync); hanged because sync->signaled was initialised to true, and there is no reason to invoke WAIT_SYNC_SIGNALED(sync) before WAIT_SYNC_RELEASE(sync) this commit initializes sync->signaled to true unless the count is zero. Thanks George for the review and guidance.
1 parent 08d08e6 commit 44a66e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

opal/threads/wait_sync.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
77
* reserved.
88
* Copyright (c) 2016 Mellanox Technologies. All rights reserved.
9+
* Copyright (c) 2016 Research Organization for Information Science
10+
* and Technology (RIST). All rights reserved.
911
* $COPYRIGHT$
1012
*
1113
* Additional copyrights may follow
@@ -86,11 +88,11 @@ static inline int sync_wait_st (ompi_wait_sync_t *sync)
8688

8789
#define WAIT_SYNC_INIT(sync,c) \
8890
do { \
89-
(sync)->count = c; \
91+
(sync)->count = (c); \
9092
(sync)->next = NULL; \
9193
(sync)->prev = NULL; \
9294
(sync)->status = 0; \
93-
(sync)->signaling = true; \
95+
(sync)->signaling = (0 != (c)); \
9496
if (opal_using_threads()) { \
9597
pthread_cond_init (&(sync)->condition, NULL); \
9698
pthread_mutex_init (&(sync)->lock, NULL); \

0 commit comments

Comments
 (0)