Digita il testo o l'indirizzo di un sito web oppure traduci un documento。 我很快就是新手。我无法同步两个周期的工作,然后显示结果。
例如:
// Step1: do the first cycle.
for value0 in list0{
doStuff()
}
// Step1: do the second cycle.
for value1 in list1{
doStuff()
}
// Show result.
showResult()
我试过这样做:
let lockQueue = dispatch_queue_create("com.test.LockQueue", nil)
dispatch_sync(lockQueue) {
// Step1: do the first cycle.
for value0 in list0{
doStuff()
}
// Step1: do the second cycle.
for value1 in list1 {
doStuff()
}
// Show result.
}
showResult()
它可以工作和编译,但不会同步两个代码的工作。实际上显示结果不完整。