ITIMERs & pthreads
Anupam Chanda
anupamc at cs.rice.edu
Tue May 31 19:57:48 PDT 2005
Hello,
My platform is FreeBSD 5.4-PRERELEASE. I am trying to use itimers with
programs using pthreads which use the scheduler activation based
libpthread. Thought ITIMER_REAL/SIGALRM works fine,
ITIMER_VIRTUAL/SIGVTALRM and ITIMER_PROF/SIGPROF are not being delivered
to the process. The problem seems to be in the following function in
kern/kern_clock.c which ignores itimers for scheduler activation-enabled
processes. (I have annotated this line with /*********/). Can you please
provide a fix to this problem.
Thanks,
Anupam
void
hardclock_process(frame)
register struct clockframe *frame;
{
struct pstats *pstats;
struct thread *td = curthread;
struct proc *p = td->td_proc;
/*
* Run current process's virtual and profile time, as needed.
*/
mtx_lock_spin_flags(&sched_lock, MTX_QUIET);
if (p->p_flag & P_SA) {
/* XXXKSE What to do? */
/******************************************************************/
} else {
pstats = p->p_stats;
if (CLKF_USERMODE(frame) &&
timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) {
p->p_sflag |= PS_ALRMPEND;
td->td_flags |= TDF_ASTPENDING;
}
if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) {
p->p_sflag |= PS_PROFPEND;
td->td_flags |= TDF_ASTPENDING;
}
}
mtx_unlock_spin_flags(&sched_lock, MTX_QUIET);
}
More information about the freebsd-threads
mailing list