diff --git a/DXFeedFramework/Native/Graal/Isolate.swift b/DXFeedFramework/Native/Graal/Isolate.swift index 2ca2d673a..fc23f9589 100644 --- a/DXFeedFramework/Native/Graal/Isolate.swift +++ b/DXFeedFramework/Native/Graal/Isolate.swift @@ -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)) + } + } } } diff --git a/DXFeedFramework/Native/Graal/IsolateThread.swift b/DXFeedFramework/Native/Graal/IsolateThread.swift index 3b0fff068..b02082bcc 100644 --- a/DXFeedFramework/Native/Graal/IsolateThread.swift +++ b/DXFeedFramework/Native/Graal/IsolateThread.swift @@ -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)"