Does any C library implement C11 threads for GNU/Linux?

不问归期 提交于 2019-11-27 03:47:33

musl now (as of Sep 2014-ish) implements C11 threads!

According to this recent musl mailing list post and other conversation on that list in Jul-Sep 2014, it appears that the musl library now (as of 2014-09-07) implements the C11 threads interface, though the comparison chart; does not as of this writing reflect this.

Since this question is re-opened, I moved this content to a proper answer.

Finally GNU LIBC 2.28 supports C11 ISO Threads.

I assume Archlinux, Gentoo and Suse Tumbleweed will support it quickly. Later in this year Fedora and Ubuntu and the others in 2019 or later.

https://github.com/jtsiomb/c11threads is a "Trivial C11 threads.h implementation over POSIX threads." contained in a single header.

Hmmm, it looks like GCC 4.9.0 actually provides substantial support for C11 standards (at least since the web docs were modified on around the end of June, 2014.

From https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Standards.html

A fourth version of the C standard, known as C11, was published in 2011 as ISO/IEC 9899:2011. GCC has substantially complete support for this standard, enabled with -std=c11 or -std=iso9899:2011. (While in development, drafts of this standard version were referred to as C1X.)

And from https://gcc.gnu.org/gcc-4.9/changes.html

ISO C11 atomics (the _Atomic type specifier and qualifier and the header) are now supported. ISO C11 generic selections (_Generic keyword) are now supported. ISO C11 thread-local storage (_Thread_local, similar to GNU C __thread) is now supported. ISO C11 support is now at a similar level of completeness to ISO C99 support: substantially complete modulo bugs, extended identifiers (supported except for corner cases when -fextended-identifiers is used), floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability). A new C extension __auto_type provides a subset of the functionality of C++11 auto in GNU C.

From that, it is hard to tell what all of that will really mean when the pedal hits the metal. An upgrade on an environment to the latest GCC 4.9.0 release and a few simple driver programs would confirm how much or how little it is being implemented.

Hope it helps.

FreeBSD provides threads.h since FreeBSD 10.0 The program needs to be linked against libstdsthreads.

PDCLib (the Public Domain C standard library) includes AFAICT full support for threads.h, and it's not a wrapper around pthreads.

FreeBSD seems to wrap around the posix threads. You can find it here: FreeBSD c11 threads. I was able to use this in Cygwin. So far no problems but I haven't used it that much yet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!