Skip to content

Commit

Permalink
coll/libnbc: add some comments on how locks are used
Browse files Browse the repository at this point in the history
no code change

Signed-off-by: Gilles Gouaillardet <[email protected]>

(cherry picked from commit 1509816)
  • Loading branch information
ggouaillardet committed Nov 30, 2016
1 parent 1ebc19d commit ca12d2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ompi/mca/coll/libnbc/coll_libnbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ struct ompi_coll_libnbc_component_t {
ompi_free_list_t requests;
opal_list_t active_requests;
int32_t active_comms;
opal_atomic_lock_t progress_lock;
opal_mutex_t lock;
opal_atomic_lock_t progress_lock; /* protect from recursive calls */
opal_mutex_t lock; /* protect access to the active_requests list */
};
typedef struct ompi_coll_libnbc_component_t ompi_coll_libnbc_component_t;

Expand Down
3 changes: 3 additions & 0 deletions ompi/mca/coll/libnbc/coll_libnbc_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,11 @@ ompi_coll_libnbc_progress(void)
{
ompi_coll_libnbc_request_t* request, *next;

/* return if invoked recursively */
if (opal_atomic_trylock(&mca_coll_libnbc_component.progress_lock)) return 0;

/* process active requests, and use mca_coll_libnbc_component.lock to access the
* mca_coll_libnbc_component.active_requests list */
OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock);
OPAL_LIST_FOREACH_SAFE(request, next, &mca_coll_libnbc_component.active_requests,
ompi_coll_libnbc_request_t) {
Expand Down

0 comments on commit ca12d2c

Please sign in to comment.