Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:07:42

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 
0004 #ifndef QWAITCONDITION_H
0005 #define QWAITCONDITION_H
0006 
0007 #include <QtCore/QDeadlineTimer>
0008 
0009 QT_BEGIN_NAMESPACE
0010 
0011 #if QT_CONFIG(thread)
0012 
0013 class QWaitConditionPrivate;
0014 class QMutex;
0015 class QReadWriteLock;
0016 
0017 class Q_CORE_EXPORT QWaitCondition
0018 {
0019 public:
0020     QWaitCondition();
0021     ~QWaitCondition();
0022 
0023     bool wait(QMutex *lockedMutex,
0024               QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever));
0025     bool wait(QMutex *lockedMutex, unsigned long time);
0026 
0027     bool wait(QReadWriteLock *lockedReadWriteLock,
0028               QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever));
0029     bool wait(QReadWriteLock *lockedReadWriteLock, unsigned long time);
0030 
0031     void wakeOne();
0032     void wakeAll();
0033 
0034     void notify_one() { wakeOne(); }
0035     void notify_all() { wakeAll(); }
0036 
0037 private:
0038     Q_DISABLE_COPY(QWaitCondition)
0039 
0040     QWaitConditionPrivate *d;
0041 };
0042 
0043 #else
0044 
0045 class QMutex;
0046 class QReadWriteLock;
0047 
0048 class Q_CORE_EXPORT QWaitCondition
0049 {
0050 public:
0051     QWaitCondition() {}
0052     ~QWaitCondition() {}
0053 
0054     bool wait(QMutex *, QDeadlineTimer = QDeadlineTimer(QDeadlineTimer::Forever))
0055     { return true; }
0056     bool wait(QReadWriteLock *, QDeadlineTimer = QDeadlineTimer(QDeadlineTimer::Forever))
0057     { return true; }
0058     bool wait(QMutex *, unsigned long) { return true; }
0059     bool wait(QReadWriteLock *, unsigned long) { return true; }
0060 
0061     void wakeOne() {}
0062     void wakeAll() {}
0063 
0064     void notify_one() { wakeOne(); }
0065     void notify_all() { wakeAll(); }
0066 };
0067 
0068 #endif // QT_CONFIG(thread)
0069 
0070 QT_END_NAMESPACE
0071 
0072 #endif // QWAITCONDITION_H