ThreadWeaver

debuggingaids.cpp
1 /* -*- C++ -*-
2  This file implements debugging aids for multithreaded applications.
3 
4  SPDX-FileCopyrightText: 2004-2013 Mirko Boehm <mirko@kde.org>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 
8  $Id: DebuggingAids.cpp 20 2005-08-08 21:02:51Z mirko $
9 */
10 
11 #include "debuggingaids.h"
12 
13 #include <threadweaver_export.h>
14 
15 /** A global mutex for the ThreadWeaver objects.
16  Generally, you should not use it in your own code. */
17 THREADWEAVER_EXPORT QMutex ThreadWeaver::GlobalMutex;
18 THREADWEAVER_EXPORT bool ThreadWeaver::Debug = true;
19 THREADWEAVER_EXPORT int ThreadWeaver::DebugLevel = 1;
20 
21 namespace ThreadWeaver
22 {
23 void mutexAssertUnlocked(QMutex *mutex, const char *where)
24 {
25  if (mutex->tryLock()) {
26  mutex->unlock();
27  } else {
28  Q_ASSERT_X(false, where, "mutexAssertUnlocked: mutex was locked!");
29  }
30 }
31 
32 void mutexAssertLocked(QMutex *mutex, const char *where)
33 {
34  if (mutex->tryLock()) {
35  mutex->unlock();
36  Q_ASSERT_X(false, where, "mutexAssertUnlocked: mutex was locked!");
37  }
38 }
39 
40 }
void unlock()
bool tryLock(int timeout)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 04:07:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.