线程在时间轴上的优先级

Priority of threads on timeline

假设我有这样的代码:

let offlineRequest = OfflineRequest(params: ["id": summaryId], apiAction: ApiAction.deleteSummary)
let offlineRequestsStore = ApplicationManager.instance().offlineRequestsStore
offlineRequestsStore.storeRequest(offlineRequest: offlineRequest) // a call with adding one more request but which call other async function to decrease RequestStore.pendingRequestInQueue() count when the call to the server is executed.

let offlineRequests = RequestStore.pendingRequestInQueue() // Does this code make any senese? Could this line be called simultaneouslywith with the line above assuming it has async call in it? 
if offlineRequests {
self.presenter?.updateHistoryDataSource()
} else {
self.getHistoryWorkouts()
}

我想了解它执行操作(任务)的时间线

例如,如果我有下一行代码

第 1 行。主线程中的 func 调用

第 2 行。异步调用函数

第 3 行.主线程中的 func 调用

Will line 3 will be executed before line 2,假设调用第3行时第2行从异步线程返回同时?

我的意思是主线程在时间线上有一些优先级,还是可以同时执行两个任务,主线程上的第 3 行何时检查结果可以更改吗?

Will line 3 will be executed before line 2

没有。这不是承诺。

does the main thread have some priority on a timeline

有时,但这不是承诺的,并不总是如此。

can two tasks be executed at the same time

是的,如果您有多个内核。是的,对于 "at the same time," 的较弱版本,即使你有一个。