build(libkernel): compile Thread on macOS #11246
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11246"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by iamthehimansh on 2026-10-25T22:32:25Z.
What
Next part of splitting #8658:
libkernel'sPthread/src/Thread.cppdoes not compile on macOS. The change is macOS-only; Linux and Windows compile the same code as before.pthread_getattr_np. It takes the stack top frompthread_get_stackaddr_npand the size frompthread_get_stacksize_np.pthread_getcpuclockid. The thread's Mach port is stored when the thread starts, and its user plus system time is read withthread_info(THREAD_BASIC_INFO).Pthread.hppholds that port in place of theclockid_ton macOS.#11201 and #10856 also change
Thread.cpp, in other functions; neither touches these lines.Tested
macOS 26 on an Apple M2 Pro, x86_64 under Rosetta 2, Release with Ninja, on
mainatb90d009d9:Pthread/src/Thread.cpp.oandPthread/Posix/Thread.cpp.ocompile, wheremainfails the first. Thelibkerneltests cannot run on macOS until the rest oflibkernelbuilds (#11240 and follow-ups), so this is a compile check only. On #8658's branch the same code passedguest_thread_cpu_clock3 of 3 runs. For Linux and Windows, I checked each file's view underunifdef -U__APPLE__, with-D__linux__and with-D_WIN32: it equalsmain.python3 tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:34:09Z.
Review: COMMENTED
The macOS branches are consistent with the APIs used: the stack bounds come from the pthread stack address/size, and the cached
pthread_mach_thread_npport is queried withTHREAD_BASIC_INFOfor user plus system CPU time. I did not find a concrete code defect. The checks on this head pass eligibility, conventions, intake, labels and report; product/build jobs are skipped, and the PR's local evidence is compile-only.Because both changed behaviors are macOS-only, could someone with macOS run the existing guest-thread stack and CPU-clock tests (or add focused coverage if those tests do not exercise these branches) before merge? I have not run the runtime paths on macOS, so I am leaving this as a comment rather than approving on compile evidence alone.
Pull request closed