mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-11 14:43:57 +00:00
[client] report locking mode used for diagnostics
This commit is contained in:
parent
58ed978767
commit
c5cbb948e2
2 changed files with 3 additions and 0 deletions
|
@ -642,6 +642,7 @@ static bool try_renderer(const int index, const LG_RendererParams lgrParams, Uin
|
||||||
int run()
|
int run()
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Looking Glass (" BUILD_VERSION ")");
|
DEBUG_INFO("Looking Glass (" BUILD_VERSION ")");
|
||||||
|
DEBUG_INFO("Locking Method: " LG_LOCK_MODE);
|
||||||
|
|
||||||
memset(&state, 0, sizeof(state));
|
memset(&state, 0, sizeof(state));
|
||||||
state.running = true;
|
state.running = true;
|
||||||
|
|
|
@ -47,12 +47,14 @@ static inline void nsleep(uint64_t ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ATOMIC_LOCKING
|
#ifdef ATOMIC_LOCKING
|
||||||
|
#define LG_LOCK_MODE "Atomic"
|
||||||
typedef volatile int LG_Lock;
|
typedef volatile int LG_Lock;
|
||||||
#define LG_LOCK_INIT(x) (x) = 0
|
#define LG_LOCK_INIT(x) (x) = 0
|
||||||
#define LG_LOCK(x) while(__sync_lock_test_and_set(&(x), 1)) {nsleep(100);}
|
#define LG_LOCK(x) while(__sync_lock_test_and_set(&(x), 1)) {nsleep(100);}
|
||||||
#define LG_UNLOCK(x) __sync_lock_release(&x)
|
#define LG_UNLOCK(x) __sync_lock_release(&x)
|
||||||
#define LG_LOCK_FREE(x)
|
#define LG_LOCK_FREE(x)
|
||||||
#else
|
#else
|
||||||
|
#define LG_LOCK_MODE "Mutex"
|
||||||
typedef SDL_mutex * LG_Lock;
|
typedef SDL_mutex * LG_Lock;
|
||||||
#define LG_LOCK_INIT(x) (x = SDL_CreateMutex())
|
#define LG_LOCK_INIT(x) (x = SDL_CreateMutex())
|
||||||
#define LG_LOCK(x) SDL_LockMutex(x)
|
#define LG_LOCK(x) SDL_LockMutex(x)
|
||||||
|
|
Loading…
Reference in a new issue