Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 May 2005 21:57:20 -0500 (CDT)
From:      Anupam Chanda <anupamc@cs.rice.edu>
To:        threads@freebsd.org
Cc:        alc@freebsd.org, Alan Cox <alc@cs.rice.edu>
Subject:   ITIMERs & pthreads
Message-ID:  <Pine.GSO.4.21.0505312147001.20275-100000@frosty.cs.rice.edu>

next in thread | raw e-mail | index | archive | help

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);
}




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.21.0505312147001.20275-100000>