This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
C11 Threads on MacOS?
- From: Quincey Koziol <koziol at lbl dot gov>
- To: libc-help at sourceware dot org
- Date: Sun, 3 Nov 2019 04:00:12 -0600
- Subject: C11 Threads on MacOS?
- Ironport-sdr: pWifZr48agdEXBUuhEBeF6eqb6X9MYnvfqvlE+1qteWmrHzNH1dntQ+yyJx335hZ0/M6HLfrCL 2APQfTtYj/fg==
Hi!
I’m using GCC 9.2 on MacOS 10.14 (Mojave), installed with homebrew. I can’t get a simple C11 threads program to compile:
#include <stdatomic.h>
#include <stdio.h>
#include <threads.h>
int main()
{
printf("sizeof(thrd_t)=%u\n", (unsigned)sizeof(thrd_t));
return(0);
}
I’m getting this from "gcc-9 -std=c11 -pthread foo.c"
foo.c:3:10: fatal error: threads.h: No such file or directory
3 | #include <threads.h>
| ^~~~~~~~~~~
compilation terminated.
I see that C11 threads was added to glibc in the 2.28 release, but how do I enable it for my builds? Is there another homebrew package I should install?
Thanks,
Quincey