From 87a83d684142b14086be25c074eaf7395645ca21 Mon Sep 17 00:00:00 2001 From: Josh Gargus Date: Wed, 5 Oct 2016 18:32:51 -0700 Subject: [PATCH] Use pthread_mutex for global lock on Linux. --- glslang/OSDependent/Unix/ossource.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/glslang/OSDependent/Unix/ossource.cpp b/glslang/OSDependent/Unix/ossource.cpp index 8e583ea..0e6d730 100644 --- a/glslang/OSDependent/Unix/ossource.cpp +++ b/glslang/OSDependent/Unix/ossource.cpp @@ -165,11 +165,12 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex) return false; } -// TODO: non-windows: if we need these on linux, flesh them out -void InitGlobalLock() { } -void GetGlobalLock() { } -void ReleaseGlobalLock() { } +static pthread_mutex_t gMutex; +void InitGlobalLock() { pthread_mutex_init(&gMutex, NULL); } +void GetGlobalLock() { pthread_mutex_lock(&gMutex); } +void ReleaseGlobalLock() { pthread_mutex_unlock(&gMutex); } +// TODO: non-windows: if we need these on linux, flesh them out void* OS_CreateThread(TThreadEntrypoint /*entry*/) { return 0; -- 2.7.4