3 ms·
C actually had better support (than C++) for double-checked locking (which is a lockless algorithm) up until relatively recently https://preshing.com/20130930/d
by anaphor 6y ago
C actually had better support (than C++) for double-checked locking (which is a lockless algorithm) up until relatively recently https://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/ https://preshing.com/20130930/double-checked-locking-is-fixe...
- lalaland1125 6y agoHuh? Both C and C++ only added support for atomics and double-checked locking in the same year: 2011 (C11 for C and C++11 for C++). How did C support double checked locking before C++ when the standards were released contemporaneously?
- deleted 6y ago[deleted]
- jcranmer 6y agoFalse. The C standard had no consideration for thread semantics prior to C11, and C11's memory model is literally and explicitly derived from C++11's memory model (which itself is adapted from Java 5's memory model). All of the discussions about how the memory model semantics for C11 and C++11 actually work take place entirely within the C++ standards committee, as is true for most new C language features these days (with the C committee largely designing merely the spellings of the new features).