discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using GCC


From: Luboš Doležel
Subject: Re: Using GCC
Date: Wed, 08 Apr 2015 09:41:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 04/08/2015 05:02 AM, John W Kennedy wrote:

>> Yes and no. There is a kernel GCD and there is a Foundation GCD, and
>> kernel GCD is not necessarily stable when used with Foundation, at
>> least on Apple.
> 
> I should rephase that. On Apple, Foundation is not necessarily stable
> when used with kernel GCD. If you are using Foundation at all, then if
> you wish to use GCD, you must use the Foundation GCD mechanisms
> (NSOperation, NSOperationQueue, etc.), rather than the kernel GCD
> mechanisms (dispatch_get_main_queue, etc.). Naturally, this has no
> direct bearing on whether the code will work on GNUStep, but there is a
> portability danger, and the problem involves race conditions, so it may
> work for months and then suddenly start to fail.
> 

I'd find this VERY strange. dispatch_* functions indeed can be used with
Foundation NSOperation etc. - there is no danger in doing that.
CFRunLoop/NSRunLoop itself is well integrated with GCD and enqueueing
blocks is a risk-free operation.

I'd also refrain from calling it "kernel GCD". It is true that some
parts needed for GCD to function are in the kernel (pthreads and pthread
workqueues), but that's it. It's a pure userspace library implemented on
top of these primitives.

On the contrary, GNUstep's NSRunLoop is not integrated into CFRunLoop
(which would integrate it into GCD). Hence, when using GCD with GNUstep,
you cannot use the main queue, but you can probably use other queues.
-- 
Luboš Doležel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]