iOS GCD custom concurrent queue execution sequence

后端 未结 2 1825
离开以前
离开以前 2021-01-19 06:51

I have question regarding this issue , According to Apple\'s documents

Concurrent Concurrent queues (also known as a type of global dispatch queue)

2条回答
  •  独厮守ぢ
    2021-01-19 07:27

    "Concurrent" means they run at the same time and no assumptions should be made about where in their progress any of them will be at any given moment and which will finish first. That is the whole meaning and implication of concurrency: between one line of code and the next in one concurrent operation - even during one line of code - anything else from any other concurrent operation might be happening.

    So, in answer to your particular question, these tasks may have started in a known order, but that happened very quickly, and after that point their progress is interleaved unpredictably. And your NSLog calls are part of that progress; they do not, and cannot, tell you when the tasks started!

提交回复
热议问题