2 ms·
You can encode mutex holding into the type system in C++ in a very similar way as Rust. E.g., APIs can take folly::Synchronized<T>::RLockedPtr: https://github.
by loeg 1y ago
You can encode mutex holding into the type system in C++ in a very similar way as Rust. E.g., APIs can take folly::Synchronized<T>::RLockedPtr: https://github.com/facebook/folly/blob/76f81836a2ccb6cd3bc7da1288e1d126d40d0800/folly/Synchronized.h#L232 https://github.com/facebook/folly/blob/76f81836a2ccb6cd3bc7d...
- School-Cotton 1y agoFair enough — you can do that, which is nice, but in Rust it happens automatically. A program that attempts to concurrently mutate the same object without taking a mutex will always fail to compile (unless you hack around this restriction with unsafe) whereas in C++ you have to intentionally build the API that way.