From owner-freebsd-arch@FreeBSD.ORG Tue Oct 6 20:42:09 2009 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6E881065670; Tue, 6 Oct 2009 20:42:09 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 5A99D8FC0C; Tue, 6 Oct 2009 20:42:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 06C089CB0CF; Tue, 6 Oct 2009 22:41:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yFirOaSXBlXb; Tue, 6 Oct 2009 22:41:52 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id AC59A9CB27B; Tue, 6 Oct 2009 22:41:52 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n96Kfq1B038538; Tue, 6 Oct 2009 22:41:52 +0200 (CEST) (envelope-from rdivacky) Date: Tue, 6 Oct 2009 22:41:52 +0200 From: Roman Divacky To: "Robert N. M. Watson" Message-ID: <20091006204152.GA37998@freebsd.org> References: <200910021440.50021.hselasky@freebsd.org> <2097B9F8-B96F-4A37-B1D1-D094D65211F4@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: arch@freebsd.org, Chuck Swiger , Hans Petter Selasky , freebsd-current@freebsd.org Subject: Re: [libdispatch-dev] GCD libdispatch w/Blocks support working on Free (f 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: Tue, 06 Oct 2009 20:42:09 -0000 On Tue, Oct 06, 2009 at 09:29:50PM +0100, Robert N. M. Watson wrote: > > On 6 Oct 2009, at 19:50, Chuck Swiger wrote: > > >Hi, Hans-- > > > >On Oct 2, 2009, at 5:40 AM, Hans Petter Selasky wrote: > >>Can the Apple's "Blocks" C language extension be used when > >>programming in the kernel? Or is this a user-space only feature? > > > >While the main benefit of blocks is in conjunction with libdispatch > >for userland apps, they can be used by themselves, in the kernel or > >elsewhere. > > When a block is instantiated (perhaps not the formal terminology), the > blocks runtime allocates memory to hold copies of relevant variables > from the calling scope. This memory allocation may present an issue in > some calling contexts in the kernel -- in particular, it won't be > appropriate in contexts were non-sleepable locks are held, interrupt > threads, etc. While it should be possible to use the primitive in the > kernel, we may want to think carefully about these implications. Also, > blocks are currently specific to clang, although with any luck gcc > will grow them also. apple-gcc can do blocks iirc not that it matters for us. judging from the discussion on gcc ML they dont like this feature (they prefer C++0x lambdas and the thing from the new C standard iirc)