Make QThread::sleep/msleep/usleep public.
Merge-request: 43 Reviewed-by: olivier Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com> Change-Id: Ic5e3ce8f49daf83665865f89fa9fd3488cc5b349 Reviewed-on: http://codereview.qt.nokia.com/2959 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>bb10
parent
3a1568c30c
commit
168fe50106
|
|
@ -101,6 +101,10 @@ public:
|
|||
// default argument causes thread to block indefinately
|
||||
bool wait(unsigned long time = ULONG_MAX);
|
||||
|
||||
static void sleep(unsigned long);
|
||||
static void msleep(unsigned long);
|
||||
static void usleep(unsigned long);
|
||||
|
||||
Q_SIGNALS:
|
||||
void started();
|
||||
void finished();
|
||||
|
|
@ -112,10 +116,6 @@ protected:
|
|||
|
||||
static void setTerminationEnabled(bool enabled = true);
|
||||
|
||||
static void sleep(unsigned long);
|
||||
static void msleep(unsigned long);
|
||||
static void usleep(unsigned long);
|
||||
|
||||
protected:
|
||||
QThread(QThreadPrivate &dd, QObject *parent = 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
#include "tst_qglthreads.h"
|
||||
|
||||
#ifdef Q_OS_SYMBIAN
|
||||
#include <unistd.h> // for usleep
|
||||
#define RUNNING_TIME 2000 // save GPU mem by running shorter time.
|
||||
#else
|
||||
#define RUNNING_TIME 5000
|
||||
|
|
@ -467,11 +466,7 @@ void tst_QGLThreads::renderInThread()
|
|||
qApp->processEvents();
|
||||
value = -value;
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
Sleep(100);
|
||||
#else
|
||||
usleep(100 * 1000);
|
||||
#endif
|
||||
QThread::msleep(100);
|
||||
}
|
||||
|
||||
QVERIFY(!thread.failure);
|
||||
|
|
@ -574,11 +569,7 @@ public slots:
|
|||
p.drawText(rect.center(), "This is a piece of text");
|
||||
p.end();
|
||||
rotAngle += 2;
|
||||
#ifdef Q_WS_WIN
|
||||
Sleep(20);
|
||||
#else
|
||||
usleep(20 * 1000);
|
||||
#endif
|
||||
QThread::msleep(20);
|
||||
}
|
||||
|
||||
fail = beginFailed;
|
||||
|
|
@ -670,11 +661,7 @@ void tst_QGLThreads::painterOnGLWidgetInThread()
|
|||
|
||||
while (painterThreads.areRunning()) {
|
||||
qApp->processEvents();
|
||||
#ifdef Q_WS_WIN
|
||||
Sleep(100);
|
||||
#else
|
||||
usleep(100 * 1000);
|
||||
#endif
|
||||
QThread::msleep(100);
|
||||
}
|
||||
QVERIFY(!painterThreads.failed());
|
||||
}
|
||||
|
|
@ -693,11 +680,7 @@ void tst_QGLThreads::painterOnPixmapInThread()
|
|||
|
||||
while (painterThreads.areRunning()) {
|
||||
qApp->processEvents();
|
||||
#ifdef Q_WS_WIN
|
||||
Sleep(100);
|
||||
#else
|
||||
usleep(100 * 1000);
|
||||
#endif
|
||||
QThread::msleep(100);
|
||||
}
|
||||
QVERIFY(!painterThreads.failed());
|
||||
}
|
||||
|
|
@ -726,11 +709,7 @@ void tst_QGLThreads::painterOnPboInThread()
|
|||
|
||||
while (painterThreads.areRunning()) {
|
||||
qApp->processEvents();
|
||||
#ifdef Q_WS_WIN
|
||||
Sleep(100);
|
||||
#else
|
||||
usleep(100 * 1000);
|
||||
#endif
|
||||
QThread::msleep(100);
|
||||
}
|
||||
QVERIFY(!painterThreads.failed());
|
||||
}
|
||||
|
|
@ -760,11 +739,7 @@ void tst_QGLThreads::painterOnFboInThread()
|
|||
|
||||
while (painterThreads.areRunning()) {
|
||||
qApp->processEvents();
|
||||
#ifdef Q_WS_WIN
|
||||
Sleep(100);
|
||||
#else
|
||||
usleep(100 * 1000);
|
||||
#endif
|
||||
QThread::msleep(100);
|
||||
}
|
||||
QVERIFY(!painterThreads.failed());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,19 +45,6 @@
|
|||
|
||||
#include <QtGui>
|
||||
|
||||
static void qSleep(int msec)
|
||||
{
|
||||
|
||||
struct Thread : public QThread
|
||||
{
|
||||
static void wait(int msec)
|
||||
{
|
||||
QThread::msleep(msec);
|
||||
}
|
||||
};
|
||||
Thread::wait(msec);
|
||||
}
|
||||
|
||||
struct Statistics {
|
||||
Statistics() : output(0),
|
||||
setGeometryCount(0), currentBenchmarkIteration(0), relayoutClicked(false), sleepMsecs(0)
|
||||
|
|
@ -70,7 +57,7 @@ struct Statistics {
|
|||
QLabel *output;
|
||||
void sleep()
|
||||
{
|
||||
qSleep(sleepMsecs);
|
||||
QThread::msleep(sleepMsecs);
|
||||
}
|
||||
int currentBenchmarkIteration;
|
||||
bool relayoutClicked;
|
||||
|
|
|
|||
Loading…
Reference in New Issue