From 3e5abb158c1924e555dc4142c4be89adc517b8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Mon, 18 May 2009 14:21:35 +0200 Subject: Make QtConcurrent compile in S60. - Use clock() on Symbian for timing. - Really don't use the STL when QT_NO_STL is defined. selectIteration decides how to iterate over the collection based on the iterator type (random access or not). Fall back to (potentially) slower forward iteration when QT_NO_STL is defined. This isn't a complete fix, the compiler still gets confused by some of the map() overloads, so QtConcurrent is still officially falls in the "Not supported" bin on S60. Revby: jbarron --- src/corelib/concurrent/qtconcurrentiteratekernel.cpp | 6 ++++++ src/corelib/concurrent/qtconcurrentiteratekernel.h | 10 +++++++++- src/corelib/concurrent/qtconcurrentthreadengine.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp index 5c20146..bfc0e82 100644 --- a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp +++ b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp @@ -108,11 +108,17 @@ static qint64 getticks() return 0; return (ts.tv_sec * 1000000000) + ts.tv_nsec; #else + +#ifdef Q_OS_SYMBIAN + return clock(); +#else // no clock_gettime(), fall back to wall time struct timeval tv; gettimeofday(&tv, 0); return (tv.tv_sec * 1000000) + tv.tv_usec; #endif + +#endif } #elif defined(Q_OS_WIN) diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.h b/src/corelib/concurrent/qtconcurrentiteratekernel.h index 38d2824..5cf4ebe 100644 --- a/src/corelib/concurrent/qtconcurrentiteratekernel.h +++ b/src/corelib/concurrent/qtconcurrentiteratekernel.h @@ -181,7 +181,10 @@ public: typedef T ResultType; IterateKernel(Iterator _begin, Iterator _end) -#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +#if defined (QT_NO_STL) + : begin(_begin), end(_end), current(_begin), currentIndex(0), + forIteration(false), progressReportingEnabled(true) +#elif !defined(QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION) : begin(_begin), end(_end), current(_begin), currentIndex(0), forIteration(selectIteration(typename std::iterator_traits::iterator_category())), progressReportingEnabled(true) #else @@ -189,7 +192,12 @@ public: forIteration(selectIteration(std::iterator_category(_begin))), progressReportingEnabled(true) #endif { +#if defined (QT_NO_STL) + iterationCount = 0; +#else iterationCount = forIteration ? std::distance(_begin, _end) : 0; + +#endif } virtual ~IterateKernel() { } diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.h b/src/corelib/concurrent/qtconcurrentthreadengine.h index 9e7d12e..444e0db 100644 --- a/src/corelib/concurrent/qtconcurrentthreadengine.h +++ b/src/corelib/concurrent/qtconcurrentthreadengine.h @@ -51,6 +51,7 @@ #include #include #include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -- cgit v0.12