From owner-freebsd-arch@FreeBSD.ORG Wed Oct 31 17:59:57 2007 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E507316A417; Wed, 31 Oct 2007 17:59:57 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id D0A1613C4AA; Wed, 31 Oct 2007 17:59:57 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 5139C1A4D8D; Wed, 31 Oct 2007 10:04:39 -0700 (PDT) Date: Wed, 31 Oct 2007 10:04:39 -0700 From: Alfred Perlstein To: Jan Grant Message-ID: <20071031170439.GE35925@elvis.mu.org> References: <20071031153248.4395A5B59@mail.bitblocks.com> <20071031161042.T41569@tribble.ilrt.bris.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071031161042.T41569@tribble.ilrt.bris.ac.uk> User-Agent: Mutt/1.4.2.3i Cc: Poul-Henning Kamp , Garance A Drosehn , freebsd-arch@FreeBSD.org Subject: Re: C++ in the kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2007 17:59:58 -0000 * Jan Grant [071031 09:57] wrote: > On Wed, 31 Oct 2007, Bakul Shah wrote: > > > For example what if you can't gain the lock and want > > to do something else? Two, while C++ gives you a way to > > solve this problem, it does it in a "clever" way, not an > > obvious way. > > RAII is a very common C++ idiom; that kind of thing'd be obvious to > anyone who's mired^Wimmersed in C++ on a regular basis. > > That's the point here - if this was the language technology already in > use, then it'd be obvious, and nobody would think much about it. It's > not, so it looks alien, much like any other alternatives that'll get > raised along the line of C-plus-stuff look alien. Amongst C++ users with > taste (and I claim that they do exist) the natural question that'll then > be asked is, since you can already express this idea in C++ why would > you adopt a less widespread (or novel) language? > > jan > > PS. Paint it green. Hhehehehe.... { mutex_locker_trylock trylock(&mutex); if (trylock.success()) { } else { } } // regardless if it succeeded, lock is now dropped. I think this might even work: { if (mutex_locker_trylock trylock(&mutex).success()) { } else { } } brb, gonna throw up. :) -- - Alfred Perlstein