Use QAtomicInt::load() and ::store()
The operator=(int) and implicit int cast operators are deprecated and will be removed. Change-Id: I5091d705fba45195239c901f210355e09e123faa Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
e3a8c165ea
commit
fbac3a0647
@@ -105,12 +105,12 @@ QAudioRingBuffer::~QAudioRingBuffer()
|
||||
|
||||
int QAudioRingBuffer::used() const
|
||||
{
|
||||
return m_bufferUsed;
|
||||
return m_bufferUsed.load();
|
||||
}
|
||||
|
||||
int QAudioRingBuffer::free() const
|
||||
{
|
||||
return m_bufferSize - m_bufferUsed;
|
||||
return m_bufferSize - m_bufferUsed.load();
|
||||
}
|
||||
|
||||
int QAudioRingBuffer::size() const
|
||||
@@ -122,7 +122,7 @@ void QAudioRingBuffer::reset()
|
||||
{
|
||||
m_readPos = 0;
|
||||
m_writePos = 0;
|
||||
m_bufferUsed = 0;
|
||||
m_bufferUsed.store(0);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -894,14 +894,14 @@ void QAudioInputPrivate::audioThreadStop()
|
||||
void QAudioInputPrivate::audioThreadStart()
|
||||
{
|
||||
startTimers();
|
||||
audioThreadState = Running;
|
||||
audioThreadState.store(Running);
|
||||
AudioOutputUnitStart(audioUnit);
|
||||
}
|
||||
|
||||
void QAudioInputPrivate::audioDeviceStop()
|
||||
{
|
||||
AudioOutputUnitStop(audioUnit);
|
||||
audioThreadState = Stopped;
|
||||
audioThreadState.store(Stopped);
|
||||
threadFinished.wakeOne();
|
||||
}
|
||||
|
||||
@@ -960,7 +960,7 @@ OSStatus QAudioInputPrivate::inputCallback(void* inRefCon,
|
||||
|
||||
QAudioInputPrivate* d = static_cast<QAudioInputPrivate*>(inRefCon);
|
||||
|
||||
const int threadState = d->audioThreadState.fetchAndAddAcquire(0);
|
||||
const int threadState = d->audioThreadState.loadAcquire();
|
||||
if (threadState == Stopped)
|
||||
d->audioDeviceStop();
|
||||
else {
|
||||
|
||||
@@ -295,7 +295,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray& device)
|
||||
clockFrequency = AudioGetHostClockFrequency() / 1000;
|
||||
errorCode = QAudio::NoError;
|
||||
stateCode = QAudio::StoppedState;
|
||||
audioThreadState = Stopped;
|
||||
audioThreadState.store(Stopped);
|
||||
|
||||
intervalTimer = new QTimer(this);
|
||||
intervalTimer->setInterval(1000);
|
||||
@@ -599,7 +599,7 @@ QAudio::State QAudioOutputPrivate::state() const
|
||||
void QAudioOutputPrivate::audioThreadStart()
|
||||
{
|
||||
startTimers();
|
||||
audioThreadState = Running;
|
||||
audioThreadState.store(Running);
|
||||
AudioOutputUnitStart(audioUnit);
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ void QAudioOutputPrivate::audioThreadDrain()
|
||||
void QAudioOutputPrivate::audioDeviceStop()
|
||||
{
|
||||
AudioOutputUnitStop(audioUnit);
|
||||
audioThreadState = Stopped;
|
||||
audioThreadState.store(Stopped);
|
||||
threadFinished.wakeOne();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user