From c5cbb948e2357edc4524a9b5ce324253116f3b90 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 21 Dec 2017 01:35:36 +1100 Subject: [PATCH] [client] report locking mode used for diagnostics --- client/main.c | 1 + client/utils.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/client/main.c b/client/main.c index 4cd43283..46373d48 100644 --- a/client/main.c +++ b/client/main.c @@ -642,6 +642,7 @@ static bool try_renderer(const int index, const LG_RendererParams lgrParams, Uin int run() { DEBUG_INFO("Looking Glass (" BUILD_VERSION ")"); + DEBUG_INFO("Locking Method: " LG_LOCK_MODE); memset(&state, 0, sizeof(state)); state.running = true; diff --git a/client/utils.h b/client/utils.h index c446c427..618dffc6 100644 --- a/client/utils.h +++ b/client/utils.h @@ -47,12 +47,14 @@ static inline void nsleep(uint64_t ns) } #ifdef ATOMIC_LOCKING + #define LG_LOCK_MODE "Atomic" typedef volatile int LG_Lock; #define LG_LOCK_INIT(x) (x) = 0 #define LG_LOCK(x) while(__sync_lock_test_and_set(&(x), 1)) {nsleep(100);} #define LG_UNLOCK(x) __sync_lock_release(&x) #define LG_LOCK_FREE(x) #else + #define LG_LOCK_MODE "Mutex" typedef SDL_mutex * LG_Lock; #define LG_LOCK_INIT(x) (x = SDL_CreateMutex()) #define LG_LOCK(x) SDL_LockMutex(x)