Skip to content

Commit

Permalink
iOS SDK creates Isolate in Main Thread(fix problem in default thread)
Browse files Browse the repository at this point in the history
  • Loading branch information
kosyloa committed Sep 11, 2023
1 parent 7e20dd7 commit 20221e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion DXFeedFramework/Native/Graal/Isolate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class Isolate {
}

init() {
try? ErrorCheck.graalCall(graal_create_isolate(self.params, self.isolate, thread))
print("DXFeedFramework.Isolate:init \(Thread.isMainThread) \(Thread.current) \(Thread.current.threadName)")
if Thread.isMainThread {
try? ErrorCheck.graalCall(graal_create_isolate(self.params, self.isolate, self.thread))
} else {
DispatchQueue.main.sync {
try? ErrorCheck.graalCall(graal_create_isolate(self.params, self.isolate, self.thread))
}
}
}
}
2 changes: 1 addition & 1 deletion DXFeedFramework/Native/Graal/IsolateThread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Required thread: \(threadName). Current thread: \(Thread.current.threadName)

}

private extension Thread {
internal extension Thread {
var threadName: String {
if let currentOperationQueue = OperationQueue.current?.name {
return "OperationQueue: \(currentOperationQueue)"
Expand Down

0 comments on commit 20221e4

Please sign in to comment.