Properly guard rand_r use with _POSIX_THREAD_SAFE_FUNCTIONS for Android.
authorRobin Burchell <robin.burchell@collabora.co.uk>
Tue, 1 May 2012 18:48:17 +0000 (20:48 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 4 May 2012 13:24:52 +0000 (15:24 +0200)
Android does not support this, or other thread-safe functions.

Change-Id: Id2a918f83e6138795196c45f89613c5b46911901
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
src/corelib/global/qglobal.cpp

index 966d66a..d359b27 100644 (file)
@@ -2168,7 +2168,7 @@ void qsrand(uint seed)
 */
 int qrand()
 {
-#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD)
+#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
     SeedStorage *seedStorage = randTLS();
     if (seedStorage) {
         SeedStorageType *pseed = seedStorage->localData();