Schedules a callback on the current thread.
(block, delayMs = 0)
| 12371 | } |
| 12372 | /** Schedules a callback on the current thread. */ |
| 12373 | schedule(block, delayMs = 0) { |
| 12374 | const threadId = this.id; |
| 12375 | const GetDisplayName = Il2Cpp.Image.corlib.class("Mono.Runtime").method("GetDisplayName"); |
| 12376 | const SendOrPostCallback = Il2Cpp.Image.corlib.class("System.Threading.SendOrPostCallback").alloc(); |
| 12377 | SendOrPostCallback.method(".ctor").invoke(NULL, GetDisplayName.handle); |
| 12378 | const Post = this.synchronizationContext.method("Post"); |
| 12379 | return new Promise(resolve => { |
| 12380 | const listener = Interceptor.attach(GetDisplayName.virtualAddress, function () { |
| 12381 | if (this.threadId == threadId) { |
| 12382 | listener.detach(); |
| 12383 | const result = block(); |
| 12384 | setImmediate(() => resolve(result)); |
| 12385 | } |
| 12386 | }); |
| 12387 | setTimeout(() => Post.invoke(SendOrPostCallback, NULL), delayMs); |
| 12388 | }); |
| 12389 | } |
| 12390 | } |
| 12391 | __decorate([ |
| 12392 | decorator_cache_getter_1.cache |