简体   繁体   中英

is glibc c11 thread implementation a wrapper on top of pthread?

to build a c11 thread program with glibc I still need link with -lpthread,why? glibc 2.28 claims c11 thread support but why I need pthread still?

musl can build c11 thread without pthread though.

Yes, glibc's C11 threads implementation is using pthreads library underneath and that's why it needs linking with pthread library. In glibc, pthreads is (was always) a separate library - thus the need to link it.

Whereas in musl library, the thread implementation is a part of the main C library itself and thus there's no need to link any thread library whether you use pthreads or C11 threads with musl. Also, see https://www.openwall.com/lists/musl/2012/07/25/3 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM