Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Sep 2002 16:42:19 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Julian Elischer <julian@elischer.org>
Cc:        John Baldwin <jhb@FreeBSD.ORG>, <arch@FreeBSD.ORG>, Alfred Perlstein <bright@mu.org>
Subject:   Re: Process/thread states.
Message-ID:  <20020904163927.N385-100000@gamplex.bde.org>
In-Reply-To: <Pine.BSF.4.21.0209031245020.12482-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 3 Sep 2002, Julian Elischer wrote:

> On Tue, 3 Sep 2002, John Baldwin wrote:
>
> > ... (I don't
> > see why just using == to check a thread state is all that hard).
>
> because it in some cases actually becomes: (due to the fact thst you
> can be on the sleep queue AND teh run queue)
> #define TD_ON_RUNQ(td) (((td)->td_state & TD_BASE_MASK) == TD_ST_RUNQ)
> as you have to separate out the sleep queue bit.
> ...
> Do you really want to type that sort of test everywhere?
> By making it a macro we can keep the implementation of this state
> hidden. e.g if we move the RUNQ part of the state to td_flags
> to make it independently testable, the rest of the code doesn;t have to
> know how we optimised this. (we are discussing this exact change now).
> similarly for swapped.. or other states.

Just don't forget to change it back to a simple test once you have debugged
and optimized it :-).  One virtue of inline code is that it inhibits expansion
of huge macros to huger ones.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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