Skip to content
Snippets Groups Projects
Commit db46ec83 authored by Morris Jette's avatar Morris Jette
Browse files

Move some logic to avoid race condition reported by helgrind

parent 8bfcff8f
No related branches found
No related tags found
No related merge requests found
...@@ -170,6 +170,8 @@ static void *_timer_thread(void *args) ...@@ -170,6 +170,8 @@ static void *_timer_thread(void *args)
if (!acct_gather_profile_timer[i].freq if (!acct_gather_profile_timer[i].freq
|| (diff < acct_gather_profile_timer[i].freq)) || (diff < acct_gather_profile_timer[i].freq))
continue; continue;
if (!acct_gather_profile_test())
break; /* Shutting down */
debug2("profile signalling type %s", debug2("profile signalling type %s",
acct_gather_profile_type_t_name(i)); acct_gather_profile_type_t_name(i));
...@@ -188,6 +190,10 @@ static void *_timer_thread(void *args) ...@@ -188,6 +190,10 @@ static void *_timer_thread(void *args)
usleep(USLEEP_TIME - DELTA_TIMER); usleep(USLEEP_TIME - DELTA_TIMER);
} }
for (i=0; i < PROFILE_CNT; i++) {
pthread_cond_destroy(&acct_gather_profile_timer[i].notify);
}
return NULL; return NULL;
} }
...@@ -523,8 +529,7 @@ extern void acct_gather_profile_endpoll(void) ...@@ -523,8 +529,7 @@ extern void acct_gather_profile_endpoll(void)
slurm_mutex_lock(&acct_gather_profile_timer[i].notify_mutex); slurm_mutex_lock(&acct_gather_profile_timer[i].notify_mutex);
pthread_cond_signal(&acct_gather_profile_timer[i].notify); pthread_cond_signal(&acct_gather_profile_timer[i].notify);
slurm_mutex_unlock(&acct_gather_profile_timer[i].notify_mutex); slurm_mutex_unlock(&acct_gather_profile_timer[i].notify_mutex);
pthread_cond_destroy(&acct_gather_profile_timer[i].notify);
acct_gather_profile_timer[i].freq = 0;
switch (i) { switch (i) {
case PROFILE_ENERGY: case PROFILE_ENERGY:
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment