mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 08:36:28 +00:00
[client] opengl: switch to SDL_mutex locking
This commit is contained in:
parent
c098967293
commit
58ed978767
@ -185,6 +185,10 @@ void opengl_deinitialize(void * opaque)
|
|||||||
if (this->mouseData)
|
if (this->mouseData)
|
||||||
free(this->mouseData);
|
free(this->mouseData);
|
||||||
|
|
||||||
|
LG_LOCK_FREE(this->formatLock);
|
||||||
|
LG_LOCK_FREE(this->syncLock );
|
||||||
|
LG_LOCK_FREE(this->mouseLock );
|
||||||
|
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,16 @@ static inline void nsleep(uint64_t ns)
|
|||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef volatile int LG_Lock;
|
#ifdef ATOMIC_LOCKING
|
||||||
#define LG_LOCK_INIT(x) (x) = 0
|
typedef volatile int LG_Lock;
|
||||||
#define LG_LOCK(x) while(__sync_lock_test_and_set(&(x), 1)) {nsleep(100);}
|
#define LG_LOCK_INIT(x) (x) = 0
|
||||||
#define LG_UNLOCK(x) __sync_lock_release(&x)
|
#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
|
||||||
|
typedef SDL_mutex * LG_Lock;
|
||||||
|
#define LG_LOCK_INIT(x) (x = SDL_CreateMutex())
|
||||||
|
#define LG_LOCK(x) SDL_LockMutex(x)
|
||||||
|
#define LG_UNLOCK(x) SDL_UnlockMutex(x)
|
||||||
|
#define LG_LOCK_FREE(x) SDL_DestroyMutex(x)
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user