NSOperationQueue should provide access to the global GCD queues
| Originator: | alancfrancis | ||
| Number: | rdar://11829234 | Date Originated: | 9th July 2012 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 6.0 |
| Classification: | Enhancement | Reproducible: | Not Applicable |
Summary: As Cocoa Developers we are encouraged where possible to use the Objective C APIs instead of lower level technologies. I recently began a sweep through my code to replace some GCD code with NSOperation/NSOperationQueue. dispatch_async calls to the main queue are easily replaceable with [NSOperationQueue mainQueue] but where dispatch_async is talking to one of the global dispatch queues it seems to be impossible to create a drop in replacement. I have to create an NSOperationQueue instance somewhere even if it only exists to queue a single block. Since NSOperationQueues are wrapping GCD queues I had assumed I'd be able to do either: [NSOperationQueue globalBackgroundQueueWithPriority:NSOperationQueuePriorityDefault]; or [NSOperationQueue operationQueueWIthUnderlyingDispatchQueue:dispatch_get_global_queue( DISPATCH_QUEUE_PROPRITY_DEFAULT, 0)]; to give me a Cocoa wrapper around the global queues. These APIs don't seem to exist, but something like them would be lovely to have.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!