#include <math.h>
-#if defined(Q_OS_UNIX)
+#ifdef Q_OS_SYMBIAN
+# include <e32std.h>
+typedef RMutex NativeMutexType;
+void NativeMutexInitialize(NativeMutexType *mutex)
+{
+ mutex->CreateLocal();
+}
+void NativeMutexDestroy(NativeMutexType *mutex)
+{
+ mutex->Close();
+}
+void NativeMutexLock(NativeMutexType *mutex)
+{
+ mutex->Wait();
+}
+void NativeMutexUnlock(NativeMutexType *mutex)
+{
+ mutex->Signal();
+}
+#elif defined(Q_OS_UNIX)
# include <pthread.h>
# include <errno.h>
typedef pthread_mutex_t NativeMutexType;
void noThread_data();
void noThread();
+ void constructionNative();
void uncontendedNative();
+ void constructionQMutex();
void uncontendedQMutex();
void uncontendedQMutexLocker();
QCOMPARE(int(count), N);
}
+void tst_QMutex::constructionNative()
+{
+ QBENCHMARK {
+ NativeMutexType mutex;
+ NativeMutexInitialize(&mutex);
+ NativeMutexDestroy(&mutex);
+ }
+}
+
void tst_QMutex::uncontendedNative()
{
NativeMutexType mutex;
NativeMutexDestroy(&mutex);
}
+void tst_QMutex::constructionQMutex()
+{
+ QBENCHMARK {
+ QMutex mutex;
+ Q_UNUSED(mutex);
+ }
+}
+
void tst_QMutex::uncontendedQMutex()
{
QMutex mutex;