summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/concurrent/qtconcurrentthreadengine.cpp5
-rw-r--r--src/corelib/concurrent/qtconcurrentthreadengine.h10
2 files changed, 13 insertions, 2 deletions
diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.cpp b/src/corelib/concurrent/qtconcurrentthreadengine.cpp
index 150540a..c6bde85 100644
--- a/src/corelib/concurrent/qtconcurrentthreadengine.cpp
+++ b/src/corelib/concurrent/qtconcurrentthreadengine.cpp
@@ -176,6 +176,11 @@ void ThreadEngineBase::startThread()
startThreadInternal();
}
+void ThreadEngineBase::acquireBarrierSemaphore()
+{
+ barrier.acquire();
+}
+
bool ThreadEngineBase::isCanceled()
{
if (futureInterface)
diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.h b/src/corelib/concurrent/qtconcurrentthreadengine.h
index 896b193..1f359fc 100644
--- a/src/corelib/concurrent/qtconcurrentthreadengine.h
+++ b/src/corelib/concurrent/qtconcurrentthreadengine.h
@@ -66,13 +66,18 @@ namespace QtConcurrent {
// The ThreadEngineBarrier counts worker threads, and allows one
// thread to wait for all others to finish. Tested for its use in
// QtConcurrent, requires more testing for use as a general class.
-class Q_CORE_EXPORT ThreadEngineBarrier
+class ThreadEngineBarrier
{
private:
// The thread count is maintained as an integer in the count atomic
// variable. The count can be either positive or negative - a negative
// count signals that a thread is waiting on the barrier.
+
+ // BC note: inlined code from Qt < 4.6 will expect to find the QMutex
+ // and QAtomicInt here. ### Qt 5: remove.
+ QMutex mutex;
QAtomicInt count;
+
QSemaphore semaphore;
public:
ThreadEngineBarrier();
@@ -103,6 +108,7 @@ public:
bool isProgressReportingEnabled();
void setProgressValue(int progress);
void setProgressRange(int minimum, int maximum);
+ void acquireBarrierSemaphore();
protected: // The user overrides these:
virtual void start() {}
@@ -170,7 +176,7 @@ public:
QFuture<T> future = QFuture<T>(futureInterfaceTyped());
start();
- barrier.acquire();
+ acquireBarrierSemaphore();
threadPool->start(this);
return future;
}