void QextSerialPort::flush() {
if (isOpen()) {
FlushFileBuffers(Win_Handle);
}
}
void QextSerialPort::flush() {
QMutexLocker lock(mutex); // line 134
if (isOpen()) {
FlushFileBuffers(Win_Handle);
}
}
To copy to clipboard, switch view to plain text mode
: mtx(m)
{
Q_ASSERT_X((val & quintptr(1u)) == quintptr(0),
"QMutexLocker", "QMutex pointer is misaligned");
relock(); // line 102
}
inline void unlock()
{
if (mtx) {
if ((val & quintptr(1u)) == quintptr(1u)) {
val &= ~quintptr(1u);
mtx->unlock();
}
}
}
inline void relock()
{
if (mtx) {
if ((val & quintptr(1u)) == quintptr(0u)) {
mtx->lock(); //line 120
val |= quintptr(1u);
}
}
}
inline explicit QMutexLocker(QMutex *m)
: mtx(m)
{
Q_ASSERT_X((val & quintptr(1u)) == quintptr(0),
"QMutexLocker", "QMutex pointer is misaligned");
relock(); // line 102
}
inline ~QMutexLocker() { unlock(); }
inline void unlock()
{
if (mtx) {
if ((val & quintptr(1u)) == quintptr(1u)) {
val &= ~quintptr(1u);
mtx->unlock();
}
}
}
inline void relock()
{
if (mtx) {
if ((val & quintptr(1u)) == quintptr(0u)) {
mtx->lock(); //line 120
val |= quintptr(1u);
}
}
}
To copy to clipboard, switch view to plain text mode
{
Qt::HANDLE self;
if (d->recursive) { //line 150 ... QMutex::QMutex(RecursionMode mode)
//: d(new MutexPrivate(mode))
if (d->owner == self) {
++d->count;
Q_ASSERT_X(d->count != 0, "QMutex::lock", "Overflow in recursion counter");
return;
}
bool isLocked = d->contenders.fetchAndAddAcquire(1) == 0;
if (!isLocked) {
#ifndef QT_NO_DEBUG
if (d->owner == self)
qWarning("QMutex::lock: Deadlock detected in thread %ld",
long(d->owner));
#endif
isLocked = d->wait();
Q_ASSERT_X(isLocked, "QMutex::lock",
"Internal error, infinite wait has timed out.");
d->contenders.deref();
}
d->owner = self;
++d->count;
Q_ASSERT_X(d->count != 0, "QMutex::lock", "Overflow in recursion counter");
return;
}
void QMutex::lock()
{
Qt::HANDLE self;
if (d->recursive) { //line 150 ... QMutex::QMutex(RecursionMode mode)
//: d(new MutexPrivate(mode))
self = QThread::currentThreadId();
if (d->owner == self) {
++d->count;
Q_ASSERT_X(d->count != 0, "QMutex::lock", "Overflow in recursion counter");
return;
}
bool isLocked = d->contenders.fetchAndAddAcquire(1) == 0;
if (!isLocked) {
#ifndef QT_NO_DEBUG
if (d->owner == self)
qWarning("QMutex::lock: Deadlock detected in thread %ld",
long(d->owner));
#endif
isLocked = d->wait();
Q_ASSERT_X(isLocked, "QMutex::lock",
"Internal error, infinite wait has timed out.");
d->contenders.deref();
}
d->owner = self;
++d->count;
Q_ASSERT_X(d->count != 0, "QMutex::lock", "Overflow in recursion counter");
return;
}
To copy to clipboard, switch view to plain text mode
Bookmarks