We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2cf0e5d + 445b79b commit f38cc00Copy full SHA for f38cc00
ompi/request/request.h
@@ -377,12 +377,15 @@ static inline int ompi_request_free(ompi_request_t** request)
377
378
static inline void ompi_request_wait_completion(ompi_request_t *req)
379
{
380
- if (opal_using_threads ()) {
+ if (opal_using_threads () && !REQUEST_COMPLETE(req)) {
381
ompi_wait_sync_t sync;
382
WAIT_SYNC_INIT(&sync, 1);
383
384
- if(OPAL_ATOMIC_CMPSET_PTR(&req->req_complete, REQUEST_PENDING, &sync)) {
+ if (OPAL_ATOMIC_CMPSET_PTR(&req->req_complete, REQUEST_PENDING, &sync)) {
385
SYNC_WAIT(&sync);
386
+ } else {
387
+ /* completed before we had a chance to swap in the sync object */
388
+ WAIT_SYNC_SIGNALLED(&sync);
389
}
390
391
assert(REQUEST_COMPLETE(req));
0 commit comments