Does suspend queue dispatch send its target queue?

I want to create two consecutive queues A and B. Where queue B is the goal of queue A. I want to queue some blocks on B and pause it until I am ready to execute them, however I want to continue executing the blocks in queue A.

If I paused B, would it also pause his target queue (queue A)?

My thinking is that I want to schedule these specific blocks (in queue B) for execution at a later (undefined) date, however I do not want them to ever start at the same time (this includes the main data ^ _ ^ ) and I do not want to deal with semaphores. But I want Queue A to continue to process its blocks, and B to pause.

In case here it was not clear what code example

dispatch_queue_t queueA = dispatch_queue_create("app.queue.A"); dispatch_queue_t queueB = dispatch_queue_create("app.queue.B"); dispatch_set_target_queue( queueB, queueA ); dispatch_suspend( queueB ); /* * Add a bunch of blocks to queue B or A * Where the ones added to A should execute immediately */ //Wait till blocks on queue A have finished and start up B dispatch_resume( queueB ); dispatch_release(queueA); dispatch_release(queueB); 
+7
source share
1 answer
 dispatch_set_target_queue(queueB, queueA); dispatch_suspend(queueB); 

queueB pauses, but queueA does not pause.

 dispatch_set_target_queue(queueB, queueA); dispatch_suspend(queueA); 

queueA and queueB are paused.

+12
source

All Articles