From 03d28dde1635e36508cff1f9eabc265cdb5febb9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 16 Jan 2019 05:58:48 +0100 Subject: compat/mutex: remove Always use the adaptive QMutex. --- dinput/dinput.cpp | 7 +++---- dinput/dinput.hpp | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'dinput') diff --git a/dinput/dinput.cpp b/dinput/dinput.cpp index 75f398ad..e896f5f1 100644 --- a/dinput/dinput.cpp +++ b/dinput/dinput.cpp @@ -1,10 +1,9 @@ #include "dinput.hpp" -#include "compat/spinlock.hpp" #include int di_t::refcnt{0}; -std::atomic_flag di_t::lock = ATOMIC_FLAG_INIT; diptr di_t::handle; +QMutex di_t::lock; diptr di_t::init_di_() { @@ -33,7 +32,7 @@ di_t::di_t() void di_t::ref_di() { - spinlock_guard l(lock); + QMutexLocker l(&lock); if (!handle) handle = init_di_(); @@ -43,7 +42,7 @@ void di_t::ref_di() void di_t::unref_di() { - spinlock_guard l(lock); + QMutexLocker l(&lock); const int refcnt_ = --refcnt; diff --git a/dinput/dinput.hpp b/dinput/dinput.hpp index 7128229b..4bb3b458 100644 --- a/dinput/dinput.hpp +++ b/dinput/dinput.hpp @@ -8,9 +8,9 @@ #pragma once -#include "export.hpp" +#include -#include +#include "export.hpp" #undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x800 @@ -26,7 +26,7 @@ class OTR_DINPUT_EXPORT di_t final static diptr handle; static int refcnt; - static std::atomic_flag lock; + static QMutex lock; static diptr init_di_(); public: -- cgit v1.2.3