mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
make QAtomicInt reference counting logic match that of QBasicAtomicInt
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
4bf04ce267
commit
ac5452a085
1 changed files with 3 additions and 5 deletions
|
@ -85,17 +85,15 @@ class Q_CORE_EXPORT QAtomicInt
|
|||
}
|
||||
|
||||
bool ref() {
|
||||
int newValue = ++m_data;
|
||||
return newValue != 0;
|
||||
return fetchAndAddOrdered(1) != -1;
|
||||
}
|
||||
|
||||
bool deref() {
|
||||
int newValue = --m_data;
|
||||
return newValue != 0;
|
||||
return fetchAndAddOrdered(-1) != 1;
|
||||
}
|
||||
|
||||
bool testAndSetRelaxed(int expectedValue, int newValue) {
|
||||
return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed);
|
||||
return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
bool testAndSetAcquire(int expectedValue, int newValue) {
|
||||
|
|
Loading…
Add table
Reference in a new issue