pthread is outdated since availability of C11 which introduced standard threading in C. The header files is <threads.h> with functions like thrd_create.
The standard functions for threading, conditions, and signalling, provide guarantees that pthreads cannot.
Well, it's the C libraries for two of those platforms that are supposed to implement threads.h (even though I'm pretty sure glibc doesn't), although I'm not sure what Windows does.
pthread is outdated since availability of C11 which introduced standard threading in C. The header files is
<threads.h>
with functions likethrd_create
.The standard functions for threading, conditions, and signalling, provide guarantees that pthreads cannot.
pthread.h
is POSIX compliant,threads.h
isn't.But sure you can use it, it's implemented in linux and freeBSD kernels.
But
threads.h
is C11 compliant so by now ALL compilers have support for C11 at least for the three major ones:MSVC
GCC
CLANG
Yup, seems nice, their is just a lack of documentation, I wanted to know what did it really does.
You can find documentation here: en.cppreference.com/w/c/thread
Well, it's the C libraries for two of those platforms that are supposed to implement
threads.h
(even though I'm pretty sure glibc doesn't), although I'm not sure what Windows does.It's not the kernels, it's the C libraries. You can have a kernel installed and not be able to do anything without a C library.
I have my answers,
threads.h
is better to use even if it's not POSIX (stackoverflow.com/a/9377007)