1
1

Merge pull request #1416 from abouteiller/bugfix/recvcancelwiththreads

Fix a potential race condition in recv cancel
Этот коммит содержится в:
Aurelien Bouteiller 2016-03-05 02:14:32 -05:00
родитель b57a191ccc 892e1ed57e
Коммит f55a06da00

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

@ -103,13 +103,14 @@ static int mca_pml_ob1_recv_request_cancel(struct ompi_request_t* ompi_request,
ompi_communicator_t *comm = request->req_recv.req_base.req_comm;
mca_pml_ob1_comm_t *ob1_comm = comm->c_pml_comm;
/* The rest should be protected behind the match logic lock */
OPAL_THREAD_LOCK(&ob1_comm->matching_lock);
if( true == request->req_match_received ) { /* way to late to cancel this one */
OPAL_THREAD_UNLOCK(&ob1_comm->matching_lock);
assert( OMPI_ANY_TAG != ompi_request->req_status.MPI_TAG ); /* not matched isn't it */
return OMPI_SUCCESS;
}
/* The rest should be protected behind the match logic lock */
OPAL_THREAD_LOCK(&ob1_comm->matching_lock);
if( request->req_recv.req_base.req_peer == OMPI_ANY_SOURCE ) {
opal_list_remove_item( &ob1_comm->wild_receives, (opal_list_item_t*)request );
} else {