Since the removal thread is the user's, but the queuing thread is not, the synchronization must be provided by DAPL. Hold the evd lock around any calls to dapls_rbuf_*.
Signed-off-by: Sean Hefty <[email protected]> --- dapl/udapl/dapl_evd_wait.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dapl/udapl/dapl_evd_wait.c b/dapl/udapl/dapl_evd_wait.c index 9fc0ba2..c973397 100644 --- a/dapl/udapl/dapl_evd_wait.c +++ b/dapl/udapl/dapl_evd_wait.c @@ -149,7 +149,6 @@ DAT_RETURN DAT_API dapl_evd_wait ( { /* Bogus state, bail out */ dat_status = DAT_ERROR (DAT_INVALID_STATE,0); - dapl_os_unlock ( &evd_ptr->header.lock ); goto bail; } @@ -160,10 +159,8 @@ DAT_RETURN DAT_API dapl_evd_wait ( evd_ptr->evd_state = evd_state; dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EVD_UNWAITABLE); - dapl_os_unlock ( &evd_ptr->header.lock ); goto bail; } - dapl_os_unlock ( &evd_ptr->header.lock ); /* @@ -185,7 +182,9 @@ DAT_RETURN DAT_API dapl_evd_wait ( * return right away if the ib_cq_handle associate with these evd * equal to IB_INVALID_HANDLE */ + dapl_os_unlock(&evd_ptr->header.lock); dapls_evd_copy_cq(evd_ptr); + dapl_os_lock(&evd_ptr->header.lock); if (dapls_rbuf_count(&evd_ptr->pending_event_queue) >= threshold) { @@ -226,6 +225,7 @@ DAT_RETURN DAT_API dapl_evd_wait ( evd_ptr->threshold = threshold; DAPL_CNTR(evd_ptr, DCNT_EVD_WAIT_BLOCKED); + dapl_os_unlock(&evd_ptr->header.lock); #ifdef CQ_WAIT_OBJECT if (evd_ptr->cq_wait_obj_handle) @@ -235,6 +235,9 @@ DAT_RETURN DAT_API dapl_evd_wait ( #endif dat_status = dapl_os_wait_object_wait ( &evd_ptr->wait_object, time_out ); + + dapl_os_lock(&evd_ptr->header.lock); + /* * FIXME: if the thread loops around and waits again * the time_out value needs to be updated. @@ -276,6 +279,7 @@ DAT_RETURN DAT_API dapl_evd_wait ( *nmore = dapls_rbuf_count(&evd_ptr->pending_event_queue); bail: + dapl_os_unlock(&evd_ptr->header.lock); if ( dat_status ) { dapl_dbg_log (DAPL_DBG_TYPE_RTN, "dapl_evd_wait () returns 0x%x\n", dat_status); -- 1.5.2.5 _______________________________________________ general mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
