@internal
()
| 12309 | class Il2CppThread extends native_struct_1.NativeStruct { |
| 12310 | /** @internal */ |
| 12311 | static get idOffset() { |
| 12312 | const handle = ptr(Il2Cpp.currentThread.internal.field("thread_id").value.toString()); |
| 12313 | const currentThreadId = Process.getCurrentThreadId(); |
| 12314 | for (let i = 0; i < 1024; i++) { |
| 12315 | const candidate = handle.add(i).readS32(); |
| 12316 | if (candidate == currentThreadId) { |
| 12317 | return i; |
| 12318 | } |
| 12319 | } |
| 12320 | (0, console_1.raise)(`couldn't determine the offset for a native thread id value`); |
| 12321 | } |
| 12322 | /** Gets the native id of the current thread. */ |
| 12323 | get id() { |
| 12324 | return ptr(this.internal.field("thread_id").value.toString()).add(Il2Cpp.Thread.idOffset).readS32(); |