summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-12-29 13:27:21 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-01-16 07:48:18 +0100
commite9bbb68829e972df2e458aa5beec0568d4737f02 (patch)
treeb305103d53214dcddb76c1f26738d334972b17d3 /gui
parenta1a9a091093c9fb711a1665de9f4d46ae5c5ab67 (diff)
compat/spinlock: implement and use it
Diffstat (limited to 'gui')
-rw-r--r--gui/init.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/gui/init.cpp b/gui/init.cpp
index 9e6b79dc..2b84beef 100644
--- a/gui/init.cpp
+++ b/gui/init.cpp
@@ -95,7 +95,8 @@ static void set_qt_style()
#ifdef _WIN32
-#include <atomic>
+#include "compat/spinlock.hpp"
+
#include <cstring>
#include <cwchar>
#include <windows.h>
@@ -108,14 +109,10 @@ static void qdebug_to_console(QtMsgType, const QMessageLogContext& ctx, const QS
if (IsDebuggerPresent())
{
static std::atomic_flag lock = ATOMIC_FLAG_INIT;
-
- while (!lock.test_and_set())
- (void)0;
+ spinlock_guard l(lock);
OutputDebugStringW(str);
OutputDebugStringW(L"\n");
-
- lock.clear();
}
else
{