Replace GlobalLock functions with std::mutex

The usage of GetGlobalLock/ReleaseGlobalLock/InitGlobalLock is replaced
by std::lock_guard which is available as of c++11, and the functions are
removed from the OSDependent ossource.cpp files.
The standalone glslang binary now explicitly depends on OSDependent, as
nothing in in the glslang library uses those functions anymore and they
are not implicitly picked up by the linker.
This commit is contained in:
Arcady Goldmints-Orlov 2023-07-31 14:45:11 -06:00 committed by arcady-lunarg
parent 171a322025
commit 396596ca4a
5 changed files with 10 additions and 82 deletions

View file

@ -37,11 +37,9 @@
#define STRICT
#define VC_EXTRALEAN 1
#include <windows.h>
#include <cassert>
#include <process.h>
#include <psapi.h>
#include <cstdio>
#include <cstdint>
//
// This file contains the Window-OS-specific functions
@ -53,28 +51,6 @@
namespace glslang {
HANDLE GlobalLock;
void InitGlobalLock()
{
GlobalLock = CreateMutex(nullptr, false, nullptr);
}
void GetGlobalLock()
{
WaitForSingleObject(GlobalLock, INFINITE);
}
void ReleaseGlobalLock()
{
ReleaseMutex(GlobalLock);
}
unsigned int __stdcall EnterGenericThread (void* entry)
{
return ((TThreadEntrypoint)entry)(nullptr);
}
//#define DUMP_COUNTERS
void OS_DumpMemoryCounters()