3 ms·
Rust does not solve this by having the mutex wrap the data it protects. The problem is checking something in the condition variable's predicate which isn't guar
by plorkyeran 3y ago
Rust does not solve this by having the mutex wrap the data it protects. The problem is checking something in the condition variable's predicate which isn't guarded by the mutex. Stopping you from accessing the data guarded by the mutex without holding the mutex does nothing to help with this.
You would need to make it so that the CV predicate can only access the state guarded by the mutex, which is not something that Rust does.