Skip to content

Commit e557ad7

Browse files
committed
Avoid atomic operation if all requests have completed
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
1 parent a937f29 commit e557ad7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ompi/mpiext/continue/c/continuation.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,12 @@ int ompi_continue_attach(
884884
assert(count >= num_registered);
885885
int num_complete = count - num_registered;
886886
int32_t last_num_active = count;
887-
if (num_complete > 0) {
887+
if (0 == num_registered) {
888+
/* all requests were complete */
889+
cont->cont_num_active = 0;
890+
last_num_active = 0;
891+
} else if (num_complete > 0) {
892+
/* some requests were complete */
888893
last_num_active = OPAL_THREAD_ADD_FETCH32(&cont->cont_num_active, -num_complete);
889894
}
890895
if (0 == last_num_active) {

0 commit comments

Comments
 (0)