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

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Mon May 4 23:32:58 PDT 2026


vonosmas 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.

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


More information about the libc-commits mailing list