Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit f807f1e

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. (cherry picked from commit open-mpi/ompi@44a66e2)
1 parent 9db54b2 commit f807f1e

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
@@ -84,11 +86,11 @@ static inline int sync_wait_st (ompi_wait_sync_t *sync)
8486

8587
#define WAIT_SYNC_INIT(sync,c) \
8688
do { \
87-
(sync)->count = c; \
89+
(sync)->count = (c); \
8890
(sync)->next = NULL; \
8991
(sync)->prev = NULL; \
9092
(sync)->status = 0; \
91-
(sync)->signaling = true; \
93+
(sync)->signaling = (0 != (c)); \
9294
if (opal_using_threads()) { \
9395
pthread_cond_init (&(sync)->condition, NULL); \
9496
pthread_mutex_init (&(sync)->lock, NULL); \

0 commit comments

Comments
 (0)