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

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Wed May 6 08:26:21 PDT 2026


kaladron wrote:

> I'm becoming convinced we should define `__thrd_id_t` and `__pthread_id_t` types and make `__thrd_get_id()` and `__pthread_get_id()` (inline) functions so the return type is explicit which would at least give us the flexibility to evolve the internal representation if needed.

Would thrd and pthread id be different?  I'm wondering if we could get away with one and propose it to the C committee as a piece of missing infra.

I like the idea of a standard supported interface for this that we can support.  I worry that we might wind up having to port a lot of different software that manages threads (python, etc).  But I haven't dug into enough code to know the cost of deviating from glibc and musl.  There shouldn't be many, at least.

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


More information about the libc-commits mailing list