Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Oct 2009 22:41:52 +0200
From:      Roman Divacky <rdivacky@freebsd.org>
To:        "Robert N. M. Watson" <rwatson@freebsd.org>
Cc:        arch@freebsd.org, Chuck Swiger <cswiger@mac.com>, Hans Petter Selasky <hselasky@freebsd.org>, freebsd-current@freebsd.org
Subject:   Re: [libdispatch-dev] GCD libdispatch w/Blocks support working on	Free (f
Message-ID:  <20091006204152.GA37998@freebsd.org>
In-Reply-To: <AEEBEAA3-6218-432D-9716-56B0CB84F9E9@freebsd.org>
References:  <alpine.BSF.2.00.0909271126590.70406@fledge.watson.org> <200910021440.50021.hselasky@freebsd.org> <2097B9F8-B96F-4A37-B1D1-D094D65211F4@mac.com> <AEEBEAA3-6218-432D-9716-56B0CB84F9E9@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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)



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