Re: Limiting GCD concurrent queues
Re: Limiting GCD concurrent queues
- Subject: Re: Limiting GCD concurrent queues
- From: Ken Thomases <email@hidden>
- Date: Fri, 08 May 2015 15:19:09 -0500
On May 8, 2015, at 1:51 PM, Carl Hoefs <email@hidden> wrote:
> I need to limit a GCD concurrent queue to a specific number of concurrently executing tasks (less than the number of cores available).
> I was hoping an API like the following might be lurking around somewhere:
>
> gcdConcQueue = dispatch_queue_create("GCDConcQueue", DISPATCH_QUEUE_CONCURRENT, 16);
>
> in which the queue manages itself behind the scenes.
> Would this make sense as an API enhancement?
Anything you think would be useful makes sense for an enhancement request. Whether Apple finds it worth doing is a different question.
> Am I overlooking something obvious?
You should use an NSOperationQueue. You can set its maxConcurrentOperationCount. You can add blocks to it using -addOperationWithBlock: or by instantiating NSBlockOperation objects and adding those with -addOperation:.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden