Attaches the caller thread to Il2Cpp domain and executes the given block.
(block)
| 10663 | } |
| 10664 | /** Attaches the caller thread to Il2Cpp domain and executes the given block. */ |
| 10665 | static async perform(block) { |
| 10666 | await this.initialize(); |
| 10667 | let thread = this.currentThread; |
| 10668 | const isForeignThread = thread == null; |
| 10669 | if (thread == null) { |
| 10670 | thread = Il2Cpp.Domain.attach(); |
| 10671 | } |
| 10672 | try { |
| 10673 | const result = block(); |
| 10674 | return result instanceof Promise ? await result : result; |
| 10675 | } |
| 10676 | catch (e) { |
| 10677 | globalThis.console.log(e); |
| 10678 | throw e; |
| 10679 | } |
| 10680 | finally { |
| 10681 | if (isForeignThread) { |
| 10682 | thread.detach(); |
| 10683 | } |
| 10684 | } |
| 10685 | } |
| 10686 | /** Creates a new `Il2Cpp.Tracer` instance. */ |
| 10687 | static trace() { |
| 10688 | return new Il2Cpp.Tracer(); |
no test coverage detected