4 ms·
> But near the end of college I had to write code using pthreads. It was awful. For what it's worth, I don't think it's C's pthread library that is painful, bu
by module0000 10y ago
> But near the end of college I had to write code using pthreads. It was awful.
For what it's worth, I don't think it's C's pthread library that is painful, but POSIX threading in general. Languages and libraries try to "simplify" threading by re-inventing pthreads. Eg: python's 'threading' module, erlang in general, java 'runnable' interface, golang's 'coroutine' thread manager...etc.
The difference between all those languages specific threading implementation and POSIX threads, are that POSIX threads work across every language, and all those implementations are only relevant to the language itself. Working with "one size fits all"(pthread) tools is inherently more complex than a simplified tool specific to one language.
Summary: once you learn POSIX threading [well] in C, using other pthread abstractions in other languages becomes much easier.
- agentgt 10y agoIf I recall it wasn't that I didn't understand the concepts but rather difficulty in debugging. At the time I was ignorant and ill experienced of proper tooling. Today when dealing with C I would probably not even bother with using threads and might just use multiple processes. I agree on the reimplementing POSIX threading and despite my rough experience pthreads was worthwhile learning about.