대기열 유형 간의 차이점을 이해하려고합니다. - 동시 - 시리얼 - - 블록은 즉시 관계없이 순서 GCD 대기열 유형
- 글로벌 큐 : 나는 그것을 알고있는 것처럼 3 종류가 있습니다 큐 - 시리얼
궁금한 점은 : 각 종류의 큐에 제출할 때 dispatch_sync와 dispatch_async의 차이점은 무엇입니까?
dispatch_sync(global_queue)^
{
// blocks are executed one after the other in no particular order
// example: block 3 executes. when it finishes block 7 executes.
}
dispatch_async(global_queue)^
{
// blocks are executed concurrently in no particular order
// example: blocks 2,4,5,7 execute at the same time.
}
dispatch_sync(main_queue)^
{
// blocks are executed one after the other in the order they were submitted
// example: block 1 executes. when it finishes block 2 will execute and so forth.
}
dispatch_async(main_queue)^
{
// blocks are executed concurrently in the order they were submitted
// example: blocks 1-4 (or whatever amount of threads the system can handle at one time) will fire at the same time.
// when the first block completes block 5 will then execute.
}
나는이 내 인식이 올바른 얼마나 알고 싶습니다 : 이것은 내가 지금까지 그것을 이해하는 방법이다.