Reputation: 10245
I am using a pretty decent tutotial I have found for GCD, in it it shows you how to declare a new dispatch queue.
Grand Central Dispatch operates using queues. Queues are a C typedef: dispatch_queue_t. To get a new global queue, we call dispatch_get_global_queue(), which takes two arguments: a long for priority and an unsigned long for options, which is unused, so we’ll pass 0ul. Here’s how we get a high-priority queue:
In it it says to pass 0ul in as a parameter like so
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
Im hoping someone can explain to me what 0ul is? and why its included?
Upvotes: 1
Views: 1539
Reputation: 5732
It's just 0 and the ul is telling the compiler that you want it to be an unsigned long to match the function signature.
dispatch_queue_t dispatch_get_global_queue(long priority, unsigned long flags);
If you don't add the ul the 0 will get treated as in integer which may cause a compiler warning.
Please look at the documentation here.
Upvotes: 4