diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2021-02-18 18:17:08 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2021-02-19 08:02:16 +0000 |
commit | ee77958998b0cd4fcfbfbf862e494951ae2c9c7b (patch) | |
tree | 03de77ce559e6efcc2f9681fd4f789110b1865a5 /src/plugins/autotoolsprojectmanager | |
parent | e4fba42a8a31a35cbb0e337657f363a1104fcc78 (diff) |
Use atomic_bool and drop QMutex locking
Change-Id: I70d472b0de717467c53bbb29cc407367b7e80e7f
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/autotoolsprojectmanager')
-rw-r--r-- | src/plugins/autotoolsprojectmanager/makefileparser.cpp | 4 | ||||
-rw-r--r-- | src/plugins/autotoolsprojectmanager/makefileparser.h | 6 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/plugins/autotoolsprojectmanager/makefileparser.cpp b/src/plugins/autotoolsprojectmanager/makefileparser.cpp index 7ad9f1097ae..0e056dda9c3 100644 --- a/src/plugins/autotoolsprojectmanager/makefileparser.cpp +++ b/src/plugins/autotoolsprojectmanager/makefileparser.cpp @@ -47,9 +47,7 @@ MakefileParser::~MakefileParser() bool MakefileParser::parse() { - m_mutex.lock(); m_cancel = false; - m_mutex.unlock(); m_success = true; m_executable.clear(); @@ -125,13 +123,11 @@ QStringList MakefileParser::cxxflags() const void MakefileParser::cancel() { - QMutexLocker locker(&m_mutex); m_cancel = true; } bool MakefileParser::isCanceled() const { - QMutexLocker locker(&m_mutex); return m_cancel; } diff --git a/src/plugins/autotoolsprojectmanager/makefileparser.h b/src/plugins/autotoolsprojectmanager/makefileparser.h index c9caec86aee..cd055aeff74 100644 --- a/src/plugins/autotoolsprojectmanager/makefileparser.h +++ b/src/plugins/autotoolsprojectmanager/makefileparser.h @@ -29,12 +29,13 @@ #include <projectexplorer/projectmacro.h> -#include <QMutex> #include <QStringList> #include <QTextStream> #include <QObject> #include <QVector> +#include <atomic> + QT_FORWARD_DECLARE_CLASS(QDir) namespace AutotoolsProjectManager { @@ -264,8 +265,7 @@ private: bool m_success = false; ///< Return value for MakefileParser::parse(). - bool m_cancel = false; ///< True, if the parsing should be cancelled. - mutable QMutex m_mutex; ///< Mutex to protect m_cancel. + std::atomic_bool m_cancel = false; ///< True, if the parsing should be cancelled. QString m_makefile; ///< Filename of the makefile QString m_executable; ///< Return value for MakefileParser::executable() |