Polarity of the weak flag was wrong. We want to use the strong variant of atomic_compare_exchange always
Former-commit-id: ab9122f2cb910bb5560a9fde16bc3c096ecfb510
This commit is contained in:
parent
c04002975d
commit
c1f7c0bcd5
@ -113,7 +113,7 @@ extern "C" int fastlock_trylock(struct fastlock *lock)
|
||||
|
||||
struct ticket ticket_expect { active, active };
|
||||
struct ticket ticket_setiflocked { active, next };
|
||||
if (__atomic_compare_exchange(&lock->m_ticket, &ticket_expect, &ticket_setiflocked, true /*strong*/, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE))
|
||||
if (__atomic_compare_exchange(&lock->m_ticket, &ticket_expect, &ticket_setiflocked, false /*strong*/, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE))
|
||||
{
|
||||
lock->m_depth = 1;
|
||||
__atomic_store_4(&lock->m_pidOwner, gettid(), __ATOMIC_RELEASE);
|
||||
@ -147,4 +147,4 @@ extern "C" void fastlock_free(struct fastlock *lock)
|
||||
bool fastlock::fOwnLock()
|
||||
{
|
||||
return gettid() == m_pidOwner;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user