1
1

Merge pull request #1835 from hjelmn/thread_fix

ompi/request: fix hang in ompi_request_wait_completion
Этот коммит содержится в:
Nathan Hjelm 2016-06-30 18:50:32 -06:00 коммит произвёл GitHub
родитель 2cf0e5d7cc 445b79bba8
Коммит f38cc00df9

Просмотреть файл

@ -377,12 +377,15 @@ static inline int ompi_request_free(ompi_request_t** request)
static inline void ompi_request_wait_completion(ompi_request_t *req)
{
if (opal_using_threads ()) {
if (opal_using_threads () && !REQUEST_COMPLETE(req)) {
ompi_wait_sync_t sync;
WAIT_SYNC_INIT(&sync, 1);
if(OPAL_ATOMIC_CMPSET_PTR(&req->req_complete, REQUEST_PENDING, &sync)) {
if (OPAL_ATOMIC_CMPSET_PTR(&req->req_complete, REQUEST_PENDING, &sync)) {
SYNC_WAIT(&sync);
} else {
/* completed before we had a chance to swap in the sync object */
WAIT_SYNC_SIGNALLED(&sync);
}
assert(REQUEST_COMPLETE(req));