Re: td->td_critnest manipulations do not use atomic_add_int ?

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 21 Dec 2005 11:19:53 -0500
On Tuesday 20 December 2005 10:04 pm, Joseph Koshy wrote:
> lr> is td ever != curthread?
>
> jhb> No.
>
> I don't think we KASSERT() this in enough places in the code
> though.

void
critical_enter(void)
{
	struct thread *td;

	td = curthread;
	td->td_critnest++;
	CTR4(KTR_CRITICAL, "critical_enter by thread %p (%ld, %s) to %d", td,
	    (long)td->td_proc->p_pid, td->td_proc->p_comm, td->td_critnest);
}

void
critical_exit(void)
{
	struct thread *td;

	td = curthread;
	KASSERT(td->td_critnest != 0,
	..
}

Need I say more?  Clearly td == curthread.

-- 
John Baldwin <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Wed Dec 21 2005 - 15:19:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:49 UTC