You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation isn't explicit about this, but I assume that the function should return true if the lock was successfully acquired. The problem is that swap returns the previous value, so this function returns true only if the lock is already acquired. So I think it should be !self.0.swap(true, Ordering::Acquire) instead.
The text was updated successfully, but these errors were encountered:
Ah, I did not notice this, sorry the duplicate report! Maybe there should be a new crates.io release for this, given that it recommends a broken spinlock implementation?
The example spinlock implementation in https://docs.rs/lock_api/0.3.3/lock_api/#example does not seem to be correct. The problem is the
try_lock
method:The documentation isn't explicit about this, but I assume that the function should return
true
if the lock was successfully acquired. The problem is thatswap
returns the previous value, so this function returns true only if the lock is already acquired. So I think it should be!self.0.swap(true, Ordering::Acquire)
instead.The text was updated successfully, but these errors were encountered: