It's 2006. I'm working with threads in C and it's awful
-
@khleedril @eniko
Are they though?
Threads have a lot more problems than memory issues
-
Oh what's that? C11 standardized threads.h? OK well the api looks pretty trash but I guess anything's better than pthreads. Let me just open VS2022, msvc, ok... #include <threads.h>
....... why are there like two dozen compiler errors *in the damn header*?
"Oh well if you're writing C you should be running Linu-"
I am not going to switch operating systems just to make it 5% less miserable to work with threads in C!!!
-
Oh what's that? C11 standardized threads.h? OK well the api looks pretty trash but I guess anything's better than pthreads. Let me just open VS2022, msvc, ok... #include <threads.h>
....... why are there like two dozen compiler errors *in the damn header*?
@eniko IIUC you can declare a C-compiler C11 compatible but not have support for the concurrency API, in which case the compiler defines __STDC_NO_THREADS__ and you can't include threads.h
-
@eniko IIUC you can declare a C-compiler C11 compatible but not have support for the concurrency API, in which case the compiler defines __STDC_NO_THREADS__ and you can't include threads.h
@gabrielesvelto that sounds like threads in C alright
-
@eniko IIUC you can declare a C-compiler C11 compatible but not have support for the concurrency API, in which case the compiler defines __STDC_NO_THREADS__ and you can't include threads.h
@gabrielesvelto @eniko
Why am I totally unsurprised.
Appalled yes, but unsurprised. -
It's 2006. I'm working with threads in C and it's awful
It's 2016. I'm working with threads in C and it's awful
It's 2026. I'm working with threads in C and it's awful
@eniko i have an easier time working with multiprocess than multithreading. that should tell you everything
-
"Oh well if you're writing C you should be running Linu-"
I am not going to switch operating systems just to make it 5% less miserable to work with threads in C!!!
@eniko also switching to linux isn't going to make compiling for windows any less miserable
threads.h will still be broken
-
Oh what's that? C11 standardized threads.h? OK well the api looks pretty trash but I guess anything's better than pthreads. Let me just open VS2022, msvc, ok... #include <threads.h>
....... why are there like two dozen compiler errors *in the damn header*?
@eniko Huh, TIL C99 has been superseded!
(My familiarity with C is just enough to be able to write patches for established software, but I can't write it from scratch.)
-
@eniko also switching to linux isn't going to make compiling for windows any less miserable
threads.h will still be broken
@clarfonthey and if you're making a single header library it still has to compile on msvc
-
@eniko Huh, TIL C99 has been superseded!
(My familiarity with C is just enough to be able to write patches for established software, but I can't write it from scratch.)
@ryan that's cause nobody feels ready to use anything past C99 yet... for many reasons
-
"Oh well if you're writing C you should be running Linu-"
I am not going to switch operating systems just to make it 5% less miserable to work with threads in C!!!
@eniko I don't know about the compile errors, but I recently learned about conditional variables in C++, which have made my muli-threading life much easier, just being able to wait for a condition before continuing. I also really like recursive_ mutex, lets you lock multiple times on one thread so locking functions can call other locking functions without worrying about a thread deadlocking itself.
-
Oh what's that? C11 standardized threads.h? OK well the api looks pretty trash but I guess anything's better than pthreads. Let me just open VS2022, msvc, ok... #include <threads.h>
....... why are there like two dozen compiler errors *in the damn header*?
@eniko this sounds like msvc, its such a pain haha
llvm on windows has gotten a lot better over the past few years, but that may not be an option for your circumstance
-
Oh what's that? C11 standardized threads.h? OK well the api looks pretty trash but I guess anything's better than pthreads. Let me just open VS2022, msvc, ok... #include <threads.h>
....... why are there like two dozen compiler errors *in the damn header*?
@eniko It’s optional and many don’t implement it
-
@pixx it's just as bad as working with threads in any other language but there's no functional standard and the api is worse
> no functional standard
Yeaaaaah
libthread is great but then i venture out into the real world and it's gone :(
-
"Oh well if you're writing C you should be running Linu-"
I am not going to switch operating systems just to make it 5% less miserable to work with threads in C!!!
@eniko tbf working with C in 2026 sounds awful even on Linux. The only real benefit seems to be setup is less of a headache in general for working with any language on Linux
I say this as someone who primarily does shit in C in 2026
-
@eniko Have you heard the good news about our lord and savior Rust yet?
@superblox
@eniko
Half shitpost/half earnestpost:
But what about in Zig? -
@eniko Sorry to use the R-word, but... Rust?
@khleedril @eniko "now you have two problems" 🤣