52 #define Q_MUTEX_T void* 53 #include <private/qmutex_p.h> 54 #include <private/qreadwritelock_p.h> 67 event = CreateEvent(NULL,
TRUE,
FALSE, NULL);
94 wce->
priority = GetThreadPriority(GetCurrentThread());
99 for (; index < queue.size(); ++
index) {
104 queue.insert(index, wce);
114 switch (WaitForSingleObject(wce->
event, time)) {
129 queue.removeAll(wce);
130 ResetEvent(wce->
event);
131 freeQueue.append(wce);
134 if (!ret && wce->
wokenUp && !queue.isEmpty()) {
136 SetEvent(other->
event);
154 if (!
d->queue.isEmpty()) {
155 qWarning(
"QWaitCondition: Destroyed while threads are still waiting");
168 qWarning(
"QWaitCondition::wait: Cannot wait on recursive mutexes");
175 bool returnValue =
d->wait(wce, time);
178 d->post(wce, returnValue);
185 if (!readWriteLock || readWriteLock->
d->
accessCount == 0)
188 qWarning(
"QWaitCondition: cannot wait on QReadWriteLocks with recursive lockForWrite()");
193 int previousAccessCount = readWriteLock->
d->
accessCount;
196 bool returnValue =
d->wait(wce, time);
198 if (previousAccessCount < 0)
202 d->post(wce, returnValue);
211 for (
int i = 0; i <
d->queue.size(); ++i) {
215 SetEvent(current->
event);
225 for (
int i = 0; i <
d->queue.size(); ++i) {
227 SetEvent(current->
event);
233 #endif // QT_NO_THREAD
#define QT_END_NAMESPACE
This macro expands to.
void lock()
Locks the mutex.
The QMutex class provides access serialization between threads.
void post(QWaitConditionEvent *wce, bool ret)
void unlock()
Unlocks the lock.
void lockForWrite()
Locks the lock for writing.
bool wait(unsigned long time)
QReadWriteLockPrivate * d
QWaitConditionEvent * pre()
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_CORE_EXPORT void qWarning(const char *,...)
void lockForRead()
Locks the lock for reading.
#define FALSE
Synonym for false.
void unlock()
Unlocks the mutex.
bool wait(QMutex *mutex, unsigned long time=ULONG_MAX)
#define TRUE
Synonym for true.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
The QReadWriteLock class provides read-write locking.
QList< QWaitConditionEvent * > EventQueue
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)