First I create a serial queue like this
static dispatch_queue_t queue = dispatch_queue_create(\"myQueue\", DISPATCH_QUEUE_SERIAL);
then, at som
The way you handle this is to use an ivar that indicates to the queued blocks they should just return:
^{
if(!canceled) {
... do work
}
}
You don't need to use a simple boolean either - you can make this more complex - but the general idea is to use one or more ivars that the block queries before doing anything.
I use this technique (but did not invent it) with great success.