Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-12 08:35:00

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QWAITCONDITION_H
0006 #define QWAITCONDITION_H
0007 
0008 #include <QtCore/QDeadlineTimer>
0009 
0010 QT_BEGIN_NAMESPACE
0011 
0012 #if QT_CONFIG(thread)
0013 
0014 class QWaitConditionPrivate;
0015 class QMutex;
0016 class QReadWriteLock;
0017 
0018 class Q_CORE_EXPORT QWaitCondition
0019 {
0020 public:
0021     QWaitCondition();
0022     ~QWaitCondition();
0023 
0024     bool wait(QMutex *lockedMutex,
0025               QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever));
0026     bool wait(QMutex *lockedMutex, unsigned long time);
0027 
0028     bool wait(QReadWriteLock *lockedReadWriteLock,
0029               QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever));
0030     bool wait(QReadWriteLock *lockedReadWriteLock, unsigned long time);
0031 
0032     void wakeOne();
0033     void wakeAll();
0034 
0035     void notify_one() { wakeOne(); }
0036     void notify_all() { wakeAll(); }
0037 
0038 private:
0039     Q_DISABLE_COPY(QWaitCondition)
0040 
0041     QWaitConditionPrivate *d;
0042 };
0043 
0044 #else
0045 
0046 class QMutex;
0047 class QReadWriteLock;
0048 
0049 class Q_CORE_EXPORT QWaitCondition
0050 {
0051 public:
0052     QWaitCondition() {}
0053     ~QWaitCondition() {}
0054 
0055     bool wait(QMutex *, QDeadlineTimer = QDeadlineTimer(QDeadlineTimer::Forever))
0056     { return true; }
0057     bool wait(QReadWriteLock *, QDeadlineTimer = QDeadlineTimer(QDeadlineTimer::Forever))
0058     { return true; }
0059     bool wait(QMutex *, unsigned long) { return true; }
0060     bool wait(QReadWriteLock *, unsigned long) { return true; }
0061 
0062     void wakeOne() {}
0063     void wakeAll() {}
0064 
0065     void notify_one() { wakeOne(); }
0066     void notify_all() { wakeAll(); }
0067 };
0068 
0069 #endif // QT_CONFIG(thread)
0070 
0071 QT_END_NAMESPACE
0072 
0073 #endif // QWAITCONDITION_H