MCPcopy Create free account
hub / github.com/axhlzy/Il2CppHookScripts / schedule

Method schedule

Il2cppHook/_Ufunc.js:12373–12389  ·  view source on GitHub ↗

Schedules a callback on the current thread.

(block, delayMs = 0)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

detachMethod · 0.80
methodMethod · 0.45
classMethod · 0.45
allocMethod · 0.45
invokeMethod · 0.45
attachMethod · 0.45

Tested by

no test coverage detected