Fix a race condition which could result in profprocs being decremented

more than once if stopprofclock is called multiple times on the same
process.
This commit is contained in:
cperciva 2004-05-03 00:48:11 +00:00
parent bf4defd302
commit 0dfa816e55

View File

@ -353,6 +353,8 @@ stopprofclock(p)
"stopprof", 0);
p->p_flag &= ~P_STOPPROF;
}
if ((p->p_flag & P_PROFIL) == 0)
return;
mtx_lock_spin(&sched_lock);
p->p_flag &= ~P_PROFIL;
if (--profprocs == 0)