Re: Mutexes in C and C++
That is certainly an improvement, but it does not stop the programmer to accidentally share "normal" variables between threads.
For example, multiple threads can read and write a global variable in C and C++. Compilers will not even warn the programmer. Static analyzers *might* be able to detect and warn.
In more complex cases (object trees, handing pointers from one thread to another), these static analyzers quickly reach their limits and might not report this type of bug.
With Sappeur and Rust, global variables must be either synchronized (being protected by an internal mutex) or the compilers will emit an error. And also all other cases of "pointer passing" between threads are secured by means of the type system and its rules.