diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/arch/qatomic_vxworks.h | 5 | ||||
-rw-r--r-- | src/corelib/global/global.pri | 1 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 122 | ||||
-rw-r--r-- | src/corelib/global/qglobalstatic.h | 157 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 14 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_unix.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_unix_p.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qfunctions_vxworks.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qfunctions_vxworks.h | 48 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_unix.cpp | 3 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary_unix.cpp | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 16 | ||||
-rw-r--r-- | src/corelib/tools/qelapsedtimer_unix.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qscopedpointer.h | 1 |
16 files changed, 255 insertions, 138 deletions
diff --git a/src/corelib/arch/qatomic_vxworks.h b/src/corelib/arch/qatomic_vxworks.h index a8664cf752..e6a7853c96 100644 --- a/src/corelib/arch/qatomic_vxworks.h +++ b/src/corelib/arch/qatomic_vxworks.h @@ -56,8 +56,13 @@ QT_BEGIN_HEADER # include <vxWorksCommon.h> # include <taskLib.h> #else +#if defined(_WRS_KERNEL) extern "C" int taskLock(); extern "C" int taskUnlock(); +#else +inline int taskLock() { return 0; } +inline int taskUnlock() { return 0; } +#endif #endif diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 01756c8419..491464621c 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -9,6 +9,7 @@ HEADERS += \ global/qendian.h \ global/qnumeric_p.h \ global/qnumeric.h \ + global/qglobalstatic.h \ global/qlibraryinfo.h \ global/qlogging.h \ global/qtypeinfo.h \ diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index a0c12b7b06..454e5d828d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -68,7 +68,7 @@ # endif #endif -#if defined(Q_OS_VXWORKS) +#if defined(Q_OS_VXWORKS) && defined(_WRS_KERNEL) # include <envLib.h> #endif diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7e029a139d..f3be05a8ec 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -664,125 +664,6 @@ typedef void (*QFunctionPointer)(); # define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO) #endif -#if defined(QT_NO_THREAD) - -template <typename T> -class QGlobalStatic -{ -public: - T *pointer; - inline QGlobalStatic(T *p) : pointer(p) { } - inline ~QGlobalStatic() { pointer = 0; } -}; - -#define Q_GLOBAL_STATIC(TYPE, NAME) \ - static TYPE *NAME() \ - { \ - static TYPE thisVariable; \ - static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \ - return thisGlobalStatic.pointer; \ - } - -#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ - static TYPE *NAME() \ - { \ - static TYPE thisVariable ARGS; \ - static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \ - return thisGlobalStatic.pointer; \ - } - -#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \ - static TYPE *NAME() \ - { \ - static TYPE thisVariable; \ - static QGlobalStatic<TYPE > thisGlobalStatic(0); \ - if (!thisGlobalStatic.pointer) { \ - TYPE *x = thisGlobalStatic.pointer = &thisVariable; \ - INITIALIZER; \ - } \ - return thisGlobalStatic.pointer; \ - } - -#else - -// forward declaration, since qatomic.h needs qglobal.h -template <typename T> class QBasicAtomicPointer; - -// POD for Q_GLOBAL_STATIC -template <typename T> -class QGlobalStatic -{ -public: - QBasicAtomicPointer<T> pointer; - bool destroyed; -}; - -// Created as a function-local static to delete a QGlobalStatic<T> -template <typename T> -class QGlobalStaticDeleter -{ -public: - QGlobalStatic<T> &globalStatic; - QGlobalStaticDeleter(QGlobalStatic<T> &_globalStatic) - : globalStatic(_globalStatic) - { } - - inline ~QGlobalStaticDeleter() - { - delete globalStatic.pointer.load(); - globalStatic.pointer.store(0); - globalStatic.destroyed = true; - } -}; - -#define Q_GLOBAL_STATIC(TYPE, NAME) \ - static TYPE *NAME() \ - { \ - static QGlobalStatic<TYPE > thisGlobalStatic \ - = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \ - if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { \ - TYPE *x = new TYPE; \ - if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \ - delete x; \ - else \ - static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \ - } \ - return thisGlobalStatic.pointer.load(); \ - } - -#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ - static TYPE *NAME() \ - { \ - static QGlobalStatic<TYPE > thisGlobalStatic \ - = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \ - if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { \ - TYPE *x = new TYPE ARGS; \ - if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \ - delete x; \ - else \ - static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \ - } \ - return thisGlobalStatic.pointer.load(); \ - } - -#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \ - static TYPE *NAME() \ - { \ - static QGlobalStatic<TYPE > thisGlobalStatic \ - = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \ - if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { \ - QScopedPointer<TYPE > x(new TYPE); \ - INITIALIZER; \ - if (thisGlobalStatic.pointer.testAndSetOrdered(0, x.data())) { \ - static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \ - x.take(); \ - } \ - } \ - return thisGlobalStatic.pointer.load(); \ - } - -#endif - Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) { return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2))); @@ -1089,6 +970,9 @@ template <typename T> struct QEnableIf<true, T> { typedef T Type; }; QT_END_NAMESPACE QT_END_HEADER +// Q_GLOBAL_STATIC +#include <QtCore/qglobalstatic.h> + // qDebug and friends #include <QtCore/qlogging.h> #include <QtCore/qflags.h> diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h new file mode 100644 index 0000000000..78a4acff12 --- /dev/null +++ b/src/corelib/global/qglobalstatic.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Intel Corporation +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/qglobal.h> + +#ifndef QGLOBALSTATIC_H +#define QGLOBALSTATIC_H + +#include <QtCore/qatomic.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +/* + * QGlobalStatic internals: + * + * The pointer is initialized to 0. + * The guard is initialized to 0. + * The guard can assume the following values: + * -2: object initialized and already destroyed + * -1: object initialized and is still valid + * 0: not initialized, the value of the pointer should be null + * +1: initializing, must wait until a state change happens + * (not used in the current implementation) + */ + +namespace QtGlobalStatic { +enum GuardValues { + Destroyed = -2, + Initialized = -1, + Uninitialized = 0, + Initializing = 1 +}; +} + +#if defined(QT_NO_THREAD) || defined(Q_CC_GNU) +// some compilers support thread-safe statics +// The IA-64 C++ ABI requires this, so we know that all GCC versions since 3.4 +// support it. C++11 also requires this behavior. +// Clang and Intel CC masquerade as GCC when compiling on Linux and Mac OS X. + +#define Q_GLOBAL_STATIC_INTERNAL(ARGS) \ + Q_DECL_HIDDEN inline Type *innerFunction() \ + { \ + struct HolderBase { \ + ~HolderBase() Q_DECL_NOTHROW \ + { guard.store(QtGlobalStatic::Destroyed); } \ + }; \ + static struct Holder : public HolderBase { \ + Type value; \ + Holder() \ + Q_DECL_NOEXCEPT_EXPR(noexcept(Type ARGS)) \ + : value ARGS \ + { guard.store(QtGlobalStatic::Initialized); } \ + } holder; \ + return &holder.value; \ + } +#else +// We don't know if this compiler supports thread-safe global statics +// so use our own locked implementation + +QT_END_NAMESPACE +#include <QtCore/qmutex.h> +QT_BEGIN_NAMESPACE + +#define Q_GLOBAL_STATIC_INTERNAL(ARGS) \ + Q_DECL_HIDDEN inline Type *innerFunction() \ + { \ + static Type *d; \ + static QBasicMutex mutex; \ + int x = guard.loadAcquire(); \ + if (Q_UNLIKELY(x >= QtGlobalStatic::Uninitialized)) { \ + QMutexLocker locker(&mutex); \ + if (guard.load() == QtGlobalStatic::Uninitialized) { \ + d = new Type ARGS; \ + static struct Cleanup { \ + ~Cleanup() { \ + delete d; \ + guard.store(QtGlobalStatic::Destroyed); \ + } \ + } cleanup; \ + guard.store(QtGlobalStatic::Initialized); \ + } \ + } \ + return d; \ + } +#endif + +// this class must be POD, unless the compiler supports thread-safe statics +template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard> +struct QGlobalStatic +{ + typedef T Type; + + bool isDestroyed() const { return guard.load() <= QtGlobalStatic::Destroyed; } + bool exists() const { return guard.load() == QtGlobalStatic::Initialized; } + operator Type *() { if (isDestroyed()) return 0; return innerFunction(); } + Type *operator()() { if (isDestroyed()) return 0; return innerFunction(); } + Type *operator->() { return innerFunction(); } + Type &operator*() { return *innerFunction(); } +}; + +#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ + namespace { namespace Q_QGS_ ## NAME { \ + typedef TYPE Type; \ + QBasicAtomicInt guard = Q_BASIC_ATOMIC_INITIALIZER(QtGlobalStatic::Uninitialized); \ + Q_GLOBAL_STATIC_INTERNAL(ARGS) \ + } } \ + static QGlobalStatic<TYPE, \ + Q_QGS_ ## NAME::innerFunction, \ + Q_QGS_ ## NAME::guard> NAME; + +#define Q_GLOBAL_STATIC(TYPE, NAME) \ + Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ()) + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QGLOBALSTATIC_H diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 60ba19e625..20e649bab5 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -73,7 +73,7 @@ static bool isFatal(QtMsgType msgType) return true; if (msgType == QtWarningMsg) { - static bool fatalWarnings = qEnvironmentVariableIsSet("QT_FATAL_WARNINGS"); + static bool fatalWarnings = !qEnvironmentVariableIsEmpty("QT_FATAL_WARNINGS"); return fatalWarnings; } diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 2fc7557509..985e0541ae 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -286,7 +286,7 @@ QString QFileSystemEngine::resolveUserName(uint userId) struct passwd *pw = 0; #if !defined(Q_OS_INTEGRITY) -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) struct passwd entry; getpwuid_r(userId, &entry, buf.data(), buf.size(), &pw); #else @@ -310,7 +310,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId) struct group *gr = 0; #if !defined(Q_OS_INTEGRITY) -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) size_max = sysconf(_SC_GETGR_R_SIZE_MAX); if (size_max == -1) size_max = 1024; @@ -685,8 +685,16 @@ QFileSystemEntry QFileSystemEngine::currentPath() } #else char currentName[PATH_MAX+1]; - if (::getcwd(currentName, PATH_MAX)) + if (::getcwd(currentName, PATH_MAX)) { +#if defined(Q_OS_VXWORKS) && defined(VXWORKS_VXSIM) + QByteArray dir(currentName); + if (dir.indexOf(':') < dir.indexOf('/')) + dir.remove(0, dir.indexOf(':')+1); + + qstrncpy(currentName, dir.constData(), PATH_MAX); +#endif result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath()); + } # if defined(QT_DEBUG) if (result.isEmpty()) qWarning("QFileSystemEngine::currentPath: getcwd() failed"); diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 7a0e9eb4ef..233b7eef2f 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -113,7 +113,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() } #elif defined(Q_OS_VXWORKS) char name[20]; - qsnprintf(name, sizeof(name), "/pipe/qt_%08x", int(taskIdCurrent)); + qsnprintf(name, sizeof(name), "/pipe/qt_%08x", int(taskIdSelf())); // make sure there is no pipe with this name pipeDevDelete(name, true); @@ -159,7 +159,7 @@ QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate() close(thread_pipe[0]); char name[20]; - qsnprintf(name, sizeof(name), "/pipe/qt_%08x", int(taskIdCurrent)); + qsnprintf(name, sizeof(name), "/pipe/qt_%08x", int(taskIdSelf())); pipeDevDelete(name, true); #else diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h index 0d91fda778..f1d33f9f09 100644 --- a/src/corelib/kernel/qeventdispatcher_unix_p.h +++ b/src/corelib/kernel/qeventdispatcher_unix_p.h @@ -61,9 +61,7 @@ #include "QtCore/qvarlengtharray.h" #include "private/qtimerinfo_unix_p.h" -#if defined(Q_OS_VXWORKS) -# include <sys/times.h> -#else +#if !defined(Q_OS_VXWORKS) # include <sys/time.h> # if (!defined(Q_OS_HPUX) || defined(__ia64)) && !defined(Q_OS_NACL) # include <sys/select.h> diff --git a/src/corelib/kernel/qfunctions_vxworks.cpp b/src/corelib/kernel/qfunctions_vxworks.cpp index 2174588757..8d25ad6a8d 100644 --- a/src/corelib/kernel/qfunctions_vxworks.cpp +++ b/src/corelib/kernel/qfunctions_vxworks.cpp @@ -46,7 +46,9 @@ #include "qplatformdefs.h" #include "qfunctions_vxworks.h" +#if defined(_WRS_KERNEL) #include <vmLib.h> +#endif #include <selectLib.h> #include <ioLib.h> @@ -92,7 +94,7 @@ int usleep(unsigned int usec) // gettimeofday() is declared, but is missing from the library // It IS however defined in the Curtis-Wright X11 libraries, so // we have to make the symbol 'weak' -#if defined(Q_CC_DIAB) +#if defined(Q_CC_DIAB) && !defined(VXWORKS_DKM) && !defined(VXWORKS_RTP) # pragma weak gettimeofday #endif int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) @@ -118,7 +120,11 @@ int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) // neither getpagesize() or sysconf(_SC_PAGESIZE) are available int getpagesize() { +#if defined(_WRS_KERNEL) return vmPageSizeGet(); +#else + return sysconf(_SC_PAGESIZE); +#endif } // symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h) diff --git a/src/corelib/kernel/qfunctions_vxworks.h b/src/corelib/kernel/qfunctions_vxworks.h index 6339903cff..6776a6a721 100644 --- a/src/corelib/kernel/qfunctions_vxworks.h +++ b/src/corelib/kernel/qfunctions_vxworks.h @@ -52,7 +52,11 @@ #include <errno.h> #include <sys/types.h> #include <sys/ioctl.h> +#if defined(_WRS_KERNEL) #include <sys/times.h> +#else +#include <sys/time.h> +#endif #include <sys/socket.h> #include <sys/stat.h> #include <sys/wait.h> @@ -61,6 +65,44 @@ #include <net/if.h> #endif +// VxWorks has public header mbuf.h which defines following variables for DKM. +// Let's undef those to because they overlap with Qt variable names- +// File mbuf.h is included in headers <netinet/in.h> <net/if.h>, so make sure +// that those are included before undef's. +#if defined(mbuf) +# undef mbuf +#endif +#if defined(m_data) +# undef m_data +#endif +#if defined(m_type) +# undef m_type +#endif +#if defined(m_next) +# undef m_next +#endif +#if defined(m_len) +# undef m_len +#endif +#if defined(m_flags) +# undef m_flags +#endif +#if defined(m_hdr) +# undef m_hdr +#endif +#if defined(m_ext) +# undef m_ext +#endif +#if defined(m_act) +# undef m_act +#endif +#if defined(m_nextpkt) +# undef m_nextpkt +#endif +#if defined(m_pkthdr) +# undef m_pkthdr +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -100,12 +142,16 @@ int rand_r(unsigned int * /*seedp*/); // no usleep() support int usleep(unsigned int); +#if defined(VXWORKS_DKM) || defined(VXWORKS_RTP) +int gettimeofday(struct timeval *, void *); +#else // gettimeofday() is declared, but is missing from the library. // It IS however defined in the Curtis-Wright X11 libraries, so // we have to make the symbol 'weak' int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak)); +#endif -// neither getpagesize() or sysconf(_SC_PAGESIZE) are available +// getpagesize() not available int getpagesize(); // symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h) diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 7f13e3b1a2..fdd73657a9 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -151,9 +151,6 @@ key_t QSharedMemoryPrivate::handle() */ int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName) { - if (QFile::exists(fileName)) - return 0; - int fd = qt_safe_open(QFile::encodeName(fileName).constData(), O_EXCL | O_CREAT | O_RDWR, 0640); if (-1 == fd) { diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 5044d09e9b..2aed877e6b 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -56,7 +56,7 @@ #include <string.h> #endif -#if defined(Q_OS_VXWORKS) || defined (Q_OS_NACL) +#if (defined(Q_OS_VXWORKS) && !defined(VXWORKS_RTP)) || defined (Q_OS_NACL) #define QT_NO_DYNAMIC_LIBRARY #endif diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 8abf1d06ef..253f3c79e7 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -488,8 +488,20 @@ static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_pr #endif const int highestPriority = QThread::TimeCriticalPriority; - int prio_min = sched_get_priority_min(*sched_policy); - int prio_max = sched_get_priority_max(*sched_policy); + int prio_min; + int prio_max; +#if defined(Q_OS_VXWORKS) && defined(VXWORKS_DKM) + // for other scheduling policies than SCHED_RR or SCHED_FIFO + prio_min = SCHED_FIFO_LOW_PRI; + prio_max = SCHED_FIFO_HIGH_PRI; + + if ((*sched_policy == SCHED_RR) || (*sched_policy == SCHED_FIFO)) +#endif + { + prio_min = sched_get_priority_min(*sched_policy); + prio_max = sched_get_priority_max(*sched_policy); + } + if (prio_min == -1 || prio_max == -1) return false; diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index e719358ce0..b0dbb1f047 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -43,8 +43,12 @@ #define _POSIX_C_SOURCE 200809L #include "qelapsedtimer.h" +#ifdef Q_OS_VXWORKS +#include "qfunctions_vxworks.h" +#else #include <sys/time.h> #include <time.h> +#endif #include <unistd.h> #include <qatomic.h> diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 5d19bcea55..f7ac8da572 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -97,7 +97,6 @@ public: { T *oldD = this->d; Cleanup::cleanup(oldD); - this->d = 0; } inline T &operator*() const |