Commit 58d7ddb2 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

tweak DistributedMutex::try_lock

Summary: To have a smaller conditional.

Reviewed By: aary

Differential Revision: D28723687

fbshipit-source-id: 6c6d9fe33c0eb8d00148cf6ab1bd9c1ce0dfae79
parent e1393143
......@@ -1125,11 +1125,7 @@ auto tryLockNoLoad(Atomic& atomic, DistributedMutex<A, T>&) {
// If this fails, then it is a no-op
using Proxy = typename DistributedMutex<A, T>::DistributedMutexStateProxy;
auto previous = atomic_fetch_set(atomic, 0, std::memory_order_acquire);
if (!previous) {
return Proxy{nullptr, kLocked};
}
return Proxy{nullptr, 0};
return Proxy{nullptr, previous ? 0 : kLocked};
}
template <template <typename> class Atomic, bool TimePublishing>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment