From: Josh Gargus Date: Thu, 6 Oct 2016 01:32:51 +0000 (-0700) Subject: Use pthread_mutex for global lock on Linux. X-Git-Tag: upstream/11.4.0~1446^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87a83d684142b14086be25c074eaf7395645ca21;p=platform%2Fupstream%2Fglslang.git Use pthread_mutex for global lock on Linux. --- 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;