summaryrefslogtreecommitdiffstats
path: root/src/corelib/concurrent
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2011-09-29 11:50:08 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-27 18:57:38 +0200
commit6476ac738ca029af95932f53b53f0705808eb80e (patch)
treed1884397040eb65d23a48a0e1a56dad3f476cf34 /src/corelib/concurrent
parent434824aede28e8c36d6991aa218f89daf2cc22fa (diff)
Replace implicit QAtomic* casts with explicit load()/store()
Change-Id: Ia7ef1a8e01001f203e409c710c977d6f4686342e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/concurrent')
-rw-r--r--src/corelib/concurrent/qfutureinterface.cpp2
-rw-r--r--src/corelib/concurrent/qfuturewatcher.cpp2
-rw-r--r--src/corelib/concurrent/qtconcurrentiteratekernel.h8
-rw-r--r--src/corelib/concurrent/qtconcurrentthreadengine.cpp10
4 files changed, 11 insertions, 11 deletions
diff --git a/src/corelib/concurrent/qfutureinterface.cpp b/src/corelib/concurrent/qfutureinterface.cpp
index 74c3af0ce0..f54b335403 100644
--- a/src/corelib/concurrent/qfutureinterface.cpp
+++ b/src/corelib/concurrent/qfutureinterface.cpp
@@ -416,7 +416,7 @@ QFutureInterfaceBase &QFutureInterfaceBase::operator=(const QFutureInterfaceBase
bool QFutureInterfaceBase::referenceCountIsOne() const
{
- return d->refCount == 1;
+ return d->refCount.load() == 1;
}
QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)
diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/corelib/concurrent/qfuturewatcher.cpp
index 5c5d65dc71..c9a16a8bbf 100644
--- a/src/corelib/concurrent/qfuturewatcher.cpp
+++ b/src/corelib/concurrent/qfuturewatcher.cpp
@@ -464,7 +464,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
emit q->resultsReadyAt(beginIndex, endIndex);
- if (int(resultAtConnected) <= 0)
+ if (resultAtConnected.load() <= 0)
break;
for (int i = beginIndex; i < endIndex; ++i)
diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.h b/src/corelib/concurrent/qtconcurrentiteratekernel.h
index c6fcb973ab..49c053caf7 100644
--- a/src/corelib/concurrent/qtconcurrentiteratekernel.h
+++ b/src/corelib/concurrent/qtconcurrentiteratekernel.h
@@ -214,9 +214,9 @@ public:
bool shouldStartThread()
{
if (forIteration)
- return (currentIndex < iterationCount) && !this->shouldThrottleThread();
+ return (currentIndex.load() < iterationCount) && !this->shouldThrottleThread();
else // whileIteration
- return (iteratorThreads == 0);
+ return (iteratorThreads.load() == 0);
}
ThreadFunctionResult threadFunction()
@@ -238,7 +238,7 @@ public:
const int currentBlockSize = blockSizeManager.blockSize();
- if (currentIndex >= iterationCount)
+ if (currentIndex.load() >= iterationCount)
break;
// Atomically reserve a block of iterationCount for this thread.
@@ -269,7 +269,7 @@ public:
// Report progress if progress reporting enabled.
if (progressReportingEnabled) {
completed.fetchAndAddAcquire(finalBlockSize);
- this->setProgressValue(this->completed);
+ this->setProgressValue(this->completed.load());
}
if (this->shouldThrottleThread())
diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.cpp b/src/corelib/concurrent/qtconcurrentthreadengine.cpp
index bb9b0800c9..71a47164d2 100644
--- a/src/corelib/concurrent/qtconcurrentthreadengine.cpp
+++ b/src/corelib/concurrent/qtconcurrentthreadengine.cpp
@@ -53,7 +53,7 @@ ThreadEngineBarrier::ThreadEngineBarrier()
void ThreadEngineBarrier::acquire()
{
forever {
- int localCount = int(count);
+ int localCount = count.load();
if (localCount < 0) {
if (count.testAndSetOrdered(localCount, localCount -1))
return;
@@ -67,7 +67,7 @@ void ThreadEngineBarrier::acquire()
int ThreadEngineBarrier::release()
{
forever {
- int localCount = int(count);
+ int localCount = count.load();
if (localCount == -1) {
if (count.testAndSetOrdered(-1, 0)) {
semaphore.release();
@@ -87,7 +87,7 @@ int ThreadEngineBarrier::release()
void ThreadEngineBarrier::wait()
{
forever {
- int localCount = int(count);
+ int localCount = count.load();
if (localCount == 0)
return;
@@ -101,7 +101,7 @@ void ThreadEngineBarrier::wait()
int ThreadEngineBarrier::currentCount()
{
- return int(count);
+ return count.load();
}
// releases a thread, unless this is the last thread.
@@ -109,7 +109,7 @@ int ThreadEngineBarrier::currentCount()
bool ThreadEngineBarrier::releaseUnlessLast()
{
forever {
- int localCount = int(count);
+ int localCount = count.load();
if (qAbs(localCount) == 1) {
return false;
} else if (localCount < 0) {