mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 20:58:07 -06:00
Use atomic primitives from standard library
QAtomicInteger underlying is using std::atomic structures, so using std::atomic directly should not be a problem for us. PR #19507.
This commit is contained in:
@@ -93,12 +93,12 @@ void TorrentCreator::checkInterruptionRequested() const
|
||||
|
||||
void TorrentCreator::requestInterruption()
|
||||
{
|
||||
m_interruptionRequested.storeRelaxed(1);
|
||||
m_interruptionRequested.store(true, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
bool TorrentCreator::isInterruptionRequested() const
|
||||
{
|
||||
return m_interruptionRequested.loadRelaxed() != 0;
|
||||
return m_interruptionRequested.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void TorrentCreator::run()
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QAtomicInt>
|
||||
#include <atomic>
|
||||
|
||||
#include <QObject>
|
||||
#include <QRunnable>
|
||||
#include <QStringList>
|
||||
@@ -96,6 +97,6 @@ namespace BitTorrent
|
||||
void checkInterruptionRequested() const;
|
||||
|
||||
TorrentCreatorParams m_params;
|
||||
QAtomicInt m_interruptionRequested;
|
||||
std::atomic_bool m_interruptionRequested;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user