Skip to content

Commit d5a8c20

Browse files
authored
Merge pull request #10561 from devreal/request-complete-atomics
Cleanup sync object handling in ompi_request_complete
2 parents f0101dc + f96a66c commit d5a8c20

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

ompi/request/request.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -522,18 +522,16 @@ static inline int ompi_request_complete(ompi_request_t* request, bool with_signa
522522
}
523523

524524
if (0 == rc) {
525-
if( OPAL_LIKELY(with_signal) ) {
526-
void *_tmp_ptr = REQUEST_PENDING;
527-
528-
if(!OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_PTR(&request->req_complete, &_tmp_ptr, REQUEST_COMPLETED)) {
529-
ompi_wait_sync_t *tmp_sync = (ompi_wait_sync_t *) OPAL_ATOMIC_SWAP_PTR(&request->req_complete,
530-
REQUEST_COMPLETED);
531-
/* In the case where another thread concurrently changed the request to REQUEST_PENDING */
532-
if( REQUEST_PENDING != tmp_sync )
533-
wait_sync_update(tmp_sync, 1, request->req_status.MPI_ERROR);
525+
if (OPAL_LIKELY(with_signal)) {
526+
527+
ompi_wait_sync_t *tmp_sync = (ompi_wait_sync_t *) OPAL_ATOMIC_SWAP_PTR(&request->req_complete,
528+
REQUEST_COMPLETED);
529+
if( REQUEST_PENDING != tmp_sync ) {
530+
wait_sync_update(tmp_sync, 1, request->req_status.MPI_ERROR);
534531
}
535-
} else
532+
} else {
536533
request->req_complete = REQUEST_COMPLETED;
534+
}
537535
}
538536

539537
return OMPI_SUCCESS;

0 commit comments

Comments
 (0)