Sources Bugzilla – Bug 14092
Support C11 threads
Last modified: 2012-05-10 15:44:57 UTC
It might be useful for glibc to implement the C11 <threads.h> functionality.
has some comments about how this might be done without having a new shared
library. (However, making pthreadtypes.h stay within the ISO C reserved
namespace may be harder than suggested there, because of C++ mangling issues;
see how when we gave the union that's pthread_attr_t a tag, it had to be
exactly "union pthread_attr_t" to avoid changing the mangling.)
I think it's safe (and probably preferable) NOT to use the same types for C11
threads. This will catch program errors of trying to call a C11 thread function
on a POSIX thread object or vice versa. Of course, if it's desirable for the
implementations to be shared (and I believe it is), then the corresponding
types should have the same *sizes*, and internally the code should just cast
away (or spirit it away with weak symbols and fake prototypes) the difference
in pointer types.
In any case, I'd like to hear a decision on what glibc intends to do on this
issue. I'm aiming to keep the C (but not C++) ABI in musl libc mostly
compatible with glibc, and not knowing what sizes glibc intends to use for the
C11 mutex, etc. types is preventing me from getting C11 threads implemented.