Skip to content

Commit

Permalink
Ensure we run at least two threads in the qmutex benchmark
Browse files Browse the repository at this point in the history
Just to ensure we don't run in a fast path that detects that only
one thread is running.
  • Loading branch information
milianw committed May 3, 2017
1 parent 80a7cc4 commit 9d0a644
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bench_qmutex/bench_qmutex.cpp
Expand Up @@ -49,7 +49,24 @@ class BenchQMutex : public QObject
{
Q_OBJECT

private:
// ensure at least two threads are running
QThread secondaryThread;

private slots:
void initTestCase()
{
QSignalSpy spy(&secondaryThread, &QThread::started);
secondaryThread.start();
QVERIFY(spy.wait());
}

void cleanupTestCase()
{
secondaryThread.quit();
QVERIFY(secondaryThread.wait());
}

Q_NEVER_INLINE void benchQMutex_data()
{
QTest::addColumn<bool>("recursive");
Expand Down

0 comments on commit 9d0a644

Please sign in to comment.