Re: dispatch_source_create NULL queue
Re: dispatch_source_create NULL queue
- Subject: Re: dispatch_source_create NULL queue
- From: Roland King <email@hidden>
- Date: Wed, 30 Apr 2014 19:37:24 +0800
Grr - I never think of checking the header file!! Thanks.
Docs bug filed.
On 30 Apr, 2014, at 7:34 pm, Bavarious <email@hidden> wrote:
> On 30 Apr 2014, at 07:38, Roland King <email@hidden> wrote:
>
>> While looking at a piece of code, which has been and continues to work fine, I found I'd never set my class' dispatch_queue member to anything, it was NULL.
>>
>> So in this piece of code,
>>
>> cleanup_timer = dispatch_source_create( DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_queue );
>>
>> I'm passing NULL for the last parameter and yet the timer block does get called and ends up being called on a dispatch queue called com.apple.root.default-overcommit-priority.
>>
>> I can't find any documentation which says anything about passing NULL for a dispatch queue doing anything useful. Is there any? I'm fairly surprised I didn't just crash either during the create or when the block tried to execute and was going to file it as a bug.
>
> The documentation is outdated.
>
> If you browse <dispatch/source.h>, you’ll see the following (queue is the last parameter):
>
> * @param queue
> * The dispatch queue to which the event handler block will be submitted.
> * If queue is DISPATCH_TARGET_QUEUE_DEFAULT, the source will submit the event
> * handler block to the default priority global queue.
>
> As it happens, currently DISPATCH_TARGET_QUEUE_DEFAULT is NULL, so libdispatch ends up using one of its predefined global queues.
>
> If you feel like it, file a documentation radar asking for the documentation to be updated.
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden