Reputation: 187
I cannot find any information about it. I have a dispatch_queue_t
in my application where I put some tasks to do. But these tasks take some time and it happens that sometimes they shouldn't be called any more so I would like to clean out queue. Is it possible?
Upvotes: 1
Views: 3003
Reputation: 41831
No, you can't remove items from a dispatch_queue_t. The two options you have are:
Upvotes: 0
Reputation: 14314
Use NSOperationQueue for these capabilities - much more convenient. After adding operations to a queue, you can cancel them and even cancel all pending operations if needed.
Here's a good tutorial to get you started: http://www.raywenderlich.com/19788/how-to-use-nsoperations-and-nsoperationqueues
Upvotes: 4