this post was submitted on 03 Oct 2023
9 points (84.6% liked)
Programming
17457 readers
66 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
As far as I know, C's
threads.h
implementation (orstd::thread
for C++) is based on POSIX threads.If you're using CMake or a similar build system that can define macros when building from Windows, then one option you have is to simply create an interface of sorts.
Something like:
It may be a bit tedious, but I don't know if there is some widely known C equivalent to the Boost library, at least for threads.
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