equal
deleted
inserted
replaced
39 ** |
39 ** |
40 ****************************************************************************/ |
40 ****************************************************************************/ |
41 |
41 |
42 #include "qplatformdefs.h" |
42 #include "qplatformdefs.h" |
43 #include "qmutex.h" |
43 #include "qmutex.h" |
|
44 #include <qdebug.h> |
44 |
45 |
45 #ifndef QT_NO_THREAD |
46 #ifndef QT_NO_THREAD |
46 #include "qatomic.h" |
47 #include "qatomic.h" |
47 #include "qthread.h" |
48 #include "qthread.h" |
48 #include "qmutex_p.h" |
49 #include "qmutex_p.h" |
157 |
158 |
158 bool isLocked = d->contenders.fetchAndAddAcquire(1) == 0; |
159 bool isLocked = d->contenders.fetchAndAddAcquire(1) == 0; |
159 if (!isLocked) { |
160 if (!isLocked) { |
160 #ifndef QT_NO_DEBUG |
161 #ifndef QT_NO_DEBUG |
161 if (d->owner == self) |
162 if (d->owner == self) |
162 qWarning("QMutex::lock: Deadlock detected in thread %ld", |
163 qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; |
163 long(d->owner)); |
|
164 #endif |
164 #endif |
165 |
165 |
166 // didn't get the lock, wait for it |
166 // didn't get the lock, wait for it |
167 isLocked = d->wait(); |
167 isLocked = d->wait(); |
168 Q_ASSERT_X(isLocked, "QMutex::lock", |
168 Q_ASSERT_X(isLocked, "QMutex::lock", |
195 // puts("spinning useless, sleeping"); |
195 // puts("spinning useless, sleeping"); |
196 isLocked = d->contenders.fetchAndAddAcquire(1) == 0; |
196 isLocked = d->contenders.fetchAndAddAcquire(1) == 0; |
197 if (!isLocked) { |
197 if (!isLocked) { |
198 #ifndef QT_NO_DEBUG |
198 #ifndef QT_NO_DEBUG |
199 if (d->owner == self) |
199 if (d->owner == self) |
200 qWarning("QMutex::lock: Deadlock detected in thread %ld", |
200 qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; |
201 long(d->owner)); |
|
202 #endif |
201 #endif |
203 |
202 |
204 // didn't get the lock, wait for it |
203 // didn't get the lock, wait for it |
205 isLocked = d->wait(); |
204 isLocked = d->wait(); |
206 Q_ASSERT_X(isLocked, "QMutex::lock", |
205 Q_ASSERT_X(isLocked, "QMutex::lock", |