SIGEMPTYSET(p->p_siglist);
SIGEMPTYSET(lp->lwp_siglist);
if (timevalisset(&p->p_realtimer.it_value))
- callout_stop(&p->p_ithandle);
+ callout_stop_sync(&p->p_ithandle);
/*
* Reset any sigio structures pointing to us as a result of
lwkt_gettoken(&p->p_token);
if (uap->which == ITIMER_REAL) {
if (timevalisset(&p->p_realtimer.it_value))
- callout_stop(&p->p_ithandle);
+ callout_stop_sync(&p->p_ithandle);
if (timevalisset(&aitv.it_value))
callout_reset(&p->p_ithandle,
tvtohz_high(&aitv.it_value), realitexpire, p);
struct timeval ctv, ntv;
p = (struct proc *)arg;
+ PHOLD(p);
lwkt_gettoken(&p->p_token);
ksignal(p, SIGALRM);
if (!timevalisset(&p->p_realtimer.it_interval)) {
timevalclear(&p->p_realtimer.it_value);
- lwkt_reltoken(&p->p_token);
- return;
+ goto done;
}
for (;;) {
timevaladd(&p->p_realtimer.it_value,
timevalsub(&ntv, &ctv);
callout_reset(&p->p_ithandle, tvtohz_low(&ntv),
realitexpire, p);
- lwkt_reltoken(&p->p_token);
- return;
+ goto done;
}
}
+done:
lwkt_reltoken(&p->p_token);
+ PRELE(p);
}
/*
if (c->c_flags & CALLOUT_DID_INIT) {
callout_stop(c);
#ifdef SMP
- sc = &softclock_pcpu_ary[c->c_gd->gd_cpuid];
+ if (c->c_gd) {
+ sc = &softclock_pcpu_ary[c->c_gd->gd_cpuid];
+ if (sc->running == c) {
+ while (sc->running == c)
+ tsleep(&sc->running, 0, "crace", 1);
+ }
+ }
#else
sc = &softclock_pcpu_ary[0];
-#endif
if (sc->running == c) {
while (sc->running == c)
tsleep(&sc->running, 0, "crace", 1);
}
+#endif
KKASSERT((c->c_flags & (CALLOUT_PENDING|CALLOUT_ACTIVE)) == 0);
}
}