From e81df263f4123a39fe6d4d50fb21f47dd242e796 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 20 Dec 2018 18:23:14 +0100 Subject: remove const correctness violations This is possibly related to a livelock where several threads do const removal in their respective code paths. Use the `mutable' specifier for the mutexes and spline's cached data. Now using the `mutable' specifier, get rid of in compat/mutex. --- compat/copyable-mutex.hpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'compat/copyable-mutex.hpp') diff --git a/compat/copyable-mutex.hpp b/compat/copyable-mutex.hpp index 46c6c88c..37e6802b 100644 --- a/compat/copyable-mutex.hpp +++ b/compat/copyable-mutex.hpp @@ -1,25 +1,21 @@ #pragma once -#include - #include #include "export.hpp" class OTR_COMPAT_EXPORT mutex { - std::optional inner; + mutable QMutex inner; public: - enum mode - { - recursive = QMutex::Recursive, - normal = QMutex::NonRecursive, - }; + using RecursionMode = QMutex::RecursionMode; + static constexpr inline RecursionMode Recursive = RecursionMode::Recursive; + static constexpr inline RecursionMode NonRecursive = RecursionMode::NonRecursive; mutex& operator=(const mutex& datum); mutex(const mutex& datum); - explicit mutex(mode m = normal); + explicit mutex(RecursionMode m); QMutex* operator&() const; operator QMutex*() const; -- cgit v1.2.3