3 ms·
> I'm not actually sure that the C++ library does anything that pthreads doesn't There’s std::atomic, which didn’t have a standardized equivalent in pthreads.
by comex 9y ago
> I'm not actually sure that the C++ library does anything that pthreads doesn't
There’s std::atomic, which didn’t have a standardized equivalent in pthreads. In lieu of that you’d see some ad-hoc combination of GCC builtins, OS-specific functions, and `volatile`, with the result often not guaranteed to work on architectures other than x86 (if at all). Compared to that, std::atomic is both more flexible and easier to get right. The C ‘backport’, stdatomic.h, is also available on most platforms these days...