2011-07-06 15 views
7

私は2つのシリアルキューAを作成したいA & B.キューBはキューAのターゲットです。私はB上のいくつかのブロックを待ち行列に入れて、実行準備が整うまで中断します。キューAでブロックを実行しています。ディスパッチキューをサスペンドすると、ターゲットキューがサスペンドされますか?

私がBをサスペンドすると、ターゲットキュー(キューA)もサスペンドしますか?

私は、後で(指定されていない)日付に実行するためにこれらの特定のブロック(キューB)をスケジュールしたいと考えていますが、同時に実行する必要はありません(これにはコアデータ^ _ ^私はセマフォを扱いたくありません。しかし、私はBが、ここでは明らかでなかった場合には

を中断している間にキューAは、それのブロックの処理を続行したいのは

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); 

答えて

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

queueBが中断されているいくつかのサンプルコードにだが、queueAは中断されていません。

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

queueAおよびqueueBが一時停止されています。

関連する問題