BearParser
Portable Executable parsing library (from PE-bear)
Loading...
Searching...
No Matches
WatchedLocker.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <QtCore>
5
6
7#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
8class WatchedLocker : public QMutexLocker<QMutex> {
9#else
10class WatchedLocker : public QMutexLocker {
11#endif
12public:
13 WatchedLocker(QMutex *mutex, bool show = false, const char *func = nullptr)
14 : QMutexLocker(mutex), showLock(show)
15 {
16 if (func) funcName = func;
17 if (showLock) {
18 std::cout << __FUNCTION__;
19 if (funcName.length()) {
20 std::cout << " : " << funcName;
21 }
22 std::cout << std::endl;
23 }
24 }
25
27 {
28 if (showLock) {
29 std::cout << __FUNCTION__;
30 if (funcName.length()) {
31 std::cout << " : " << funcName;
32 }
33 std::cout << std::endl;
34 }
35 }
36
37protected:
38 std::string funcName;
40};
std::string funcName
WatchedLocker(QMutex *mutex, bool show=false, const char *func=nullptr)