summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2010-07-13 10:23:05 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2010-07-13 10:23:05 (GMT)
commita736d333aab9e2e97fdbb738b3f3f4646afe192e (patch)
tree2dd641098e6ab1dc9624e35328e99957e91ab00f /src/corelib/plugin
parenta0fffeed6fceb8244328b649a3f6feb520493bc2 (diff)
downloadQt-a736d333aab9e2e97fdbb738b3f3f4646afe192e.zip
Qt-a736d333aab9e2e97fdbb738b3f3f4646afe192e.tar.gz
Qt-a736d333aab9e2e97fdbb738b3f3f4646afe192e.tar.bz2
Compile when bootstrapping qmake
QThreadStorage is not available when bootstrapping qmake, so fall back to a simple static bool instead. Reviewed-by: TrustMe
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/quuid.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index d0c59a4..e1d4fc0 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -592,11 +592,13 @@ QUuid QUuid::createUuid()
randbits = r;
}
+ // Seed the PRNG once per thread with a combination of current time, a
+ // stack address and a serial counter (since thread stack addresses are
+ // re-used).
+#ifndef QT_BOOTSTRAPPED
static QThreadStorage<int *> uuidseed;
- if (!uuidseed.hasLocalData()) {
- // Seed the PRNG once per thread with a combination of current time, a
- // stack address and a serial counter (since thread stack addresses are
- // re-used).
+ if (!uuidseed.hasLocalData())
+ {
int *pseed = new int;
static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2);
qsrand(*pseed = QDateTime::currentDateTime().toTime_t()
@@ -604,6 +606,12 @@ QUuid QUuid::createUuid()
+ serial.fetchAndAddRelaxed(1));
uuidseed.setLocalData(pseed);
}
+#else
+ static bool seeded = false;
+ if (!seeded)
+ qsrand(QDateTime::currentDateTime().toTime_t()
+ + quintptr(&seeded));
+#endif
QUuid result;
uint *data = &(result.data1);