From owner-cvs-all@FreeBSD.ORG Mon Mar 12 19:54:36 2007 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 93E1716A403; Mon, 12 Mar 2007 19:54:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 37ECC13C458; Mon, 12 Mar 2007 19:54:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l2CJsYSK064108; Mon, 12 Mar 2007 14:54:34 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Pawel Jakub Dawidek Date: Mon, 12 Mar 2007 15:35:21 -0400 User-Agent: KMail/1.9.1 References: <200703092241.l29Mf2Ds062856@repoman.freebsd.org> <200703121116.24667.jhb@freebsd.org> <20070312185638.GA5688@garage.freebsd.pl> In-Reply-To: <20070312185638.GA5688@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200703121535.22140.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 12 Mar 2007 14:54:34 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2825/Mon Mar 12 12:11:35 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Attilio Rao , cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/share/man/man9 Makefile condvar.9 lock.9 mi_switch.9 mtx_pool.9 mutex.9 rwlock.9 sleep.9 sleepqueue.9 sx.9 thread_exit.9 src/sys/kern kern_synch.c src/sys/sys mutex.h rwlock.h sleepqueue.h sx.h systm.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2007 19:54:36 -0000 On Monday 12 March 2007 14:56, Pawel Jakub Dawidek wrote: > On Mon, Mar 12, 2007 at 11:16:23AM -0400, John Baldwin wrote: > > On Saturday 10 March 2007 15:52, Pawel Jakub Dawidek wrote: > > > What about something like this: > > > > > > #define cv_wait(cv, lock) do { > > > switch (LO_CLASSINDEX((struct lock_object *)(lock))) { > > > > The problem with a cast is you use type checking. Might as well do this: > > > > #define cv_wait(cv, lock) _cv_wait((cv), (struct lock_object *)(lock)) > > This will skip type checking and my version only cast to provide type > checking, so when you pass some random variable it will give you an > error. Not really, you may pass some garbage and the LO_CLASSINDEX turns out to be a mutex. :) You only get a runtime error, not a compile-time one. Type-checking by the compiler is nice because you get compile-time errors. -- John Baldwin