[libc-commits] [libc] [libc] Add an extension macro to get numerical thread id (PR #195202)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Tue May 5 09:55:59 PDT 2026


SchrodingerZhu wrote:

> OK, I've updated the macro to work in C code and added a test. libc++ changes would be two code blocks under `#if _LIBCPP_LIBC_LLVM_LIBC` to specify
> 
> ```
> typedef int __libcpp_thread_id;
> 
> inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) {
>   return __PTHREAD_GET_ID(*__t);
> }
> ```
> 
> LMK if you'd like me to clear this change with libcxx folks before proceeding with this PR.

Current proposal looks good to me thou I am not one of the libcxx people 🤣  .


https://github.com/llvm/llvm-project/pull/195202


More information about the libc-commits mailing list