The perils of pinning
The perils of pinning
Posted Sep 16, 2022 4:08 UTC (Fri) by Cyberax (✭ supporter ✭, #52523)In reply to: The perils of pinning by milesrout
Parent article: The perils of pinning
> This sounds very similar to the "const means thread-safe" idea
It's quite a bit different. In C++ const functions do not change the "logical" state and can be called through a const pointer/reference. But there's nothing preventing you from sharing a mutable reference across threads and changing the object while a `const` function is running.
Rust goes further. The language guarantees that at any given time there is only one reference through which you can change an object and no other references.