ios – When can I run a synchronous code by executing DispatchQueue.fundamental.sync { }?


I had assumed that as a result of the sync { } technique is there meaning there may be some context that it may be used.

Sure, however that does not imply it must be utilized to the fundamental queue.

Is there completely no use for executing synchronous code on the primary
queue?

The sync command blocks and waits for its operation on the desired queue. That queue can actually be the primary queue. However the queue that blocks can’t be the primary queue! You should by no means say sync if you end up on the primary queue, and you will need to actually by no means say DispatchQueue.fundamental.sync if you end up on the primary queue as you can be blocking your self ceaselessly.

Leave a Reply