[libcxx-commits] [libcxx] [libc++] Consolidate ordering/hashing/formatting of std::thread::id. (PR #195763)

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 5 00:17:18 PDT 2026


petrhosek wrote:

The main downside of this approach is that for every libc not covered by the existing code (i.e. every libc where `thrd_t` or `pthread_t` is not a pointer or an integer), you need to modify libc++, which makes it more difficult to maintain a support for a custom libc out of tree.

Right now we have a single threading implementation for `pthread` and `c11` threads but I don't think that accurately reflects the reality. Most aspects of the `pthread` and `c11` are generic and portable across libc implementations, but some like the thread ID are specific to each libc and it would be cleaner to have a per-libc implementation of those. This would be similar to our handling of [locale](https://github.com/vonosmas/llvm-project/tree/3e10839a6bb63e1539b1a5632f7b5675a44121e7/libcxx/include/__locale_dir/support) and should cover the existing cases such as [z/OS](https://github.com/vonosmas/llvm-project/blob/3e10839a6bb63e1539b1a5632f7b5675a44121e7/libcxx/include/__thread/support/pthread.h#L160-L162) as well as new use cases such as LLVM libc.

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


More information about the libcxx-commits mailing list