• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dispatch_source_create NULL queue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dispatch_source_create NULL queue


  • Subject: Re: dispatch_source_create NULL queue
  • From: Bavarious <email@hidden>
  • Date: Wed, 30 Apr 2014 08:34:27 -0300

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


  • Follow-Ups:
    • Re: dispatch_source_create NULL queue
      • From: Roland King <email@hidden>
References: 
 >dispatch_source_create NULL queue (From: Roland King <email@hidden>)

  • Prev by Date: dispatch_source_create NULL queue
  • Next by Date: Re: dispatch_source_create NULL queue
  • Previous by thread: dispatch_source_create NULL queue
  • Next by thread: Re: dispatch_source_create NULL queue
  • Index(es):
    • Date
    • Thread