Due to the lack of material on dispatch_set_target_queue
, I have come here for help, so thanks!
Here is my test code:
dispatch_queue_t
According to me when you set a target queue to other you are synchronizing the task of both the queue so
In first case:
dispatch_set_target_queue(mySerialDispatchQueue2, mySerialDispatchQueue1);
mySerialDispatchQueue1
is target queue so all the task added in mySerialDispatchQueue2
is also enqueued from the mySerialDispatchQueue1
. As it is target queue.So mySerialDispatchQueue1
has already two task so other one from queue mySerialDispatchQueue2
is added later.
In second Case:
dispatch_set_target_queue(mySerialDispatchQueue1, mySerialDispatchQueue2);
your target queue is mySerialDispatchQueue2
so in start when there is no task then task from mySerialDispatchQueue1
is added in the mySerialDispatchQueue2
then its own task is in queue. So in this way task has been added.