Without realizing what I was getting myself into, I wrote some code using C11's threads.h (EDIT: every time I use the angle brackets < and > they just get eaten, even in the code snippet block.) I'm realizing after the fact that this is basically only supported on Linux (gcc/clang). This is my target platform, but I guess if I could cross compile to Windows or macOS that would be nice, too.

C's threads nominally appear to be a great feature. Finally, a standardized and straightforward interface to threads that would be cross-platform compatible. The reality appears to be anything but.

So is it worth just replacing that code with pthreads? Is there some near-term development on C threads that might make this worthwhile to use? I'm kind of surprised it hasn't really caught on some 12 years after the standard was introduced.

  • neo [he/him]
    hexagon
    ·
    edit-2
    9 months ago

    Yeah. I think I'll end up having to do platform-specific ifdefs with either pthreads or threads.h, so I guess I may as well use the much better established pthreads and get macOS support by default. In fact, I just now learned that even glibc didn't support C11 threads until 2018, according to this https://sourceware.org/bugzilla/show_bug.cgi?id=14092#c10