4 ms·
Both C and C++ have had a concurrent memory model and threads in the standard library for a decade now. And POSIX threads which are pretty much the same thing h
by sigotirandolas 6y ago
Both C and C++ have had a concurrent memory model and threads in the standard library for a decade now. And POSIX threads which are pretty much the same thing have been there for a quarter century on *NIX.
- fetbaffe 6y agoSure, there are libraries for concurrency, but there are no language constructs like in other languages.
- cogman10 6y agoWhat do you mean by language constructs? As in, a `synchronized` keyword? Or are you thinking along the lines of `async` `await`? If you mean the `synchronized` keyword, then correct, they don't have that. Most languages do not have that concept. C++ does have mutexes and has had them since C++11 (nearly a decade). C++ also has as part of the language spec the concept of threads, again, there since C++11. If you meant co-routines, then C++ just added them with C++20. Or do you mean something different like green threads (ala go)? C++ certainly has concurrency constructs and has been expanding them since C++11.
- fetbaffe 6y agoLike Gos goroutines or Erlangs processes. And more of message passing. C++ has added many of these things later on in the standard library, bolted on afterwards.
- erichocean 6y agoIf you think that using libraries to do things in C++ means they are "bolted on", then you don't understand C++. The entire design of C++ is to enable efficient libraries for these kinds of things to be built. And it does, and has, and will continue to for decades more.