Skip to content

Commit

Permalink
Seed qsrand() in every thread. qrand() uses thread local storage for …
Browse files Browse the repository at this point in the history
…it's seed so if we want to see something that looks random on windows where we use qrand() we need to initialize it for each thread.
  • Loading branch information
daniel-kristjansson committed Aug 24, 2011
1 parent 77f51e1 commit fdfd49d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mythtv/libs/libmythbase/mthread.cpp
Expand Up @@ -26,6 +26,7 @@ using namespace std;
#include <QStringList>
#include <QTimerEvent>
#include <QRunnable>
#include <QtGlobal>
#include <QSet>

// MythTV headers
Expand Down Expand Up @@ -207,6 +208,8 @@ void MThread::RunProlog(void)
}
setTerminationEnabled(false);
threadRegister(m_thread->objectName());
qsrand(QDateTime::currentDateTime().toTime_t() ^
QTime::currentTime().msec());
m_prolog_executed = true;
}

Expand Down

0 comments on commit fdfd49d

Please sign in to comment.