9
Was my decision to use C threads unwise?
(hexbear.net)
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
Follow the wormhole through a path of communities !webdev@programming.dev
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
Sadly. angle brackes do not work for that codeblock.
I swear they did in the preview