1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 10:24:12 +01:00

[dxvk] Optimize spinlock implementation

This commit is contained in:
Philip Rebohle 2019-05-07 13:38:02 +02:00
parent 584fd870b2
commit 0224dbc371
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -32,10 +32,8 @@ namespace dxvk::sync {
}
bool try_lock() {
uint32_t expected = 0;
return m_lock.compare_exchange_strong(expected, 1,
std::memory_order_acquire,
std::memory_order_relaxed);
return !m_lock.load()
&& !m_lock.exchange(1, std::memory_order_acquire);
}
private: