helgrind issue fixed by reading last_compile under a mutex
This commit is contained in:
parent
6d65af5288
commit
6a3b577d79
1 changed files with 5 additions and 6 deletions
|
|
@ -34,24 +34,23 @@ void *monitor_routine(void *param)
|
||||||
{
|
{
|
||||||
t_state *state;
|
t_state *state;
|
||||||
int i;
|
int i;
|
||||||
|
long last;
|
||||||
int done_coders;
|
int done_coders;
|
||||||
t_args args;
|
|
||||||
|
|
||||||
state = param;
|
state = param;
|
||||||
args = state->args;
|
|
||||||
done_coders = 0;
|
done_coders = 0;
|
||||||
while (done_coders < args.number_of_coders && !is_over(state))
|
while (done_coders < state->args.number_of_coders && !is_over(state))
|
||||||
{
|
{
|
||||||
done_coders = 0;
|
done_coders = 0;
|
||||||
i = -1;
|
i = -1;
|
||||||
while (++i < state->args.number_of_coders)
|
while (++i < state->args.number_of_coders)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&state->coders[i].info_mutex);
|
pthread_mutex_lock(&state->coders[i].info_mutex);
|
||||||
if (state->coders[i].compiles_done == args.compiles_todo)
|
last = state->coders[i].last_compile;
|
||||||
|
if (state->coders[i].compiles_done == state->args.compiles_todo)
|
||||||
done_coders++;
|
done_coders++;
|
||||||
pthread_mutex_unlock(&state->coders[i].info_mutex);
|
pthread_mutex_unlock(&state->coders[i].info_mutex);
|
||||||
if (now()
|
if (now() - last >= state->args.time_to_burnout)
|
||||||
- state->coders[i].last_compile >= state->args.time_to_burnout)
|
|
||||||
return (stop_prog(state, i), NULL);
|
return (stop_prog(state, i), NULL);
|
||||||
}
|
}
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue