时间轴上的线程优先级

问题描述 投票:0回答:1

假设我有一些类似的代码:

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行。主线程中的函数调用

第2行。异步中的func调用

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

假设在同时调用第3行时,第2行从异步线程返回,将在第2行之前执行第3行

我的意思是主线程在时间轴上具有某些优先级,或者可以同时执行两个任务,并且主线程上的第3行将检查结果是否可以更改?

假设我有一些代码,例如:let offlineRequest = OfflineRequest(params:[“ id”:summaryId],apiAction:ApiAction.deleteSummary)let offlineRequestsStore = ApplicationManager.instance()。...

swift asynchronous grand-central-dispatch
1个回答
0
投票
将在第2行之前执行第3行
© www.soinside.com 2019 - 2024. All rights reserved.