Skip to content

Commit

Permalink
Remove race looking up open containers (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
tom95858 authored Nov 18, 2019
1 parent f870a72 commit 9c8740c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ldms/src/store/store_sos.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,18 @@ static void put_container(sos_handle_t h)

static sos_handle_t find_container(const char *path)
{
sos_handle_t h;
sos_handle_t h = NULL;
pthread_mutex_lock(&cfg_lock);
LIST_FOREACH(h, &sos_handle_list, entry){
if (0 != strncmp(path, h->path, sizeof(h->path)))
continue;

/* found */
/* take reference */
pthread_mutex_lock(&cfg_lock);
h->ref_count++;
pthread_mutex_unlock(&cfg_lock);
return h;
break;
}
return NULL;
pthread_mutex_unlock(&cfg_lock);
return h;
}

/**
Expand Down

0 comments on commit 9c8740c

Please sign in to comment.