In Objective-C and Swift, is there any guarantee of order of execution for concurrent calls being made inside of a serial queue's async block?
Pseudo-code:
let serialQueue = SerialQueue()
let concurrentQueue = ConcurrentQueue()
serialQueue.async { // 1
concurrentQueue.async { // 2
run_task1() // task that takes 1 hour
}
}
serialQueue.async { // 3
concurrentQueue.async { // 4
run_task2() // task that takes 1 minute
}
}
In the above code, is task1 guaranteed to complete before task2 is called?
Or since they're called on a concurrent thread, the serial queue async only guarantees that run_task1 will be added to the concurrentQueue before run_task2, but not guarantee order of execution?