From owner-freebsd-arch Tue Sep 3 23:35: 8 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 82AD337B400; Tue, 3 Sep 2002 23:35:06 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3838443E3B; Tue, 3 Sep 2002 23:35:05 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id GAA22570; Wed, 4 Sep 2002 06:34:57 GMT Date: Wed, 4 Sep 2002 16:42:19 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Julian Elischer Cc: John Baldwin , , Alfred Perlstein Subject: Re: Process/thread states. In-Reply-To: Message-ID: <20020904163927.N385-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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