mirror of
https://github.com/RPCS3/glslang.git
synced 2025-01-31 08:02:10 +00:00
Memory: Restore unused interfaces, in case other tools called them.
This commit is contained in:
parent
94f28eb61a
commit
74bde98778
@ -115,4 +115,51 @@ bool InitThread()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not necessary to call this: InitThread() is reentrant, and the need
|
||||||
|
// to do per thread tear down has been removed.
|
||||||
|
//
|
||||||
|
// This is kept, with memory management removed, to satisfy any exiting
|
||||||
|
// calls to it that rely on it.
|
||||||
|
bool DetachThread()
|
||||||
|
{
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
|
if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Function is re-entrant and this thread may not have been initialized.
|
||||||
|
//
|
||||||
|
if (OS_GetTLSValue(ThreadInitializeIndex) != 0) {
|
||||||
|
if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) {
|
||||||
|
assert(0 && "DetachThread(): Unable to clear init flag.");
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not necessary to call this: InitProcess() is reentrant.
|
||||||
|
//
|
||||||
|
// This is kept, with memory management removed, to satisfy any exiting
|
||||||
|
// calls to it that rely on it.
|
||||||
|
//
|
||||||
|
// Users of glslang should call shFinalize() or glslang::FinalizeProcess() for
|
||||||
|
// process-scoped memory tear down.
|
||||||
|
bool DetachProcess()
|
||||||
|
{
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
|
if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
success = DetachThread();
|
||||||
|
|
||||||
|
OS_FreeTLSIndex(ThreadInitializeIndex);
|
||||||
|
ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
@ -40,6 +40,8 @@ namespace glslang {
|
|||||||
|
|
||||||
bool InitProcess();
|
bool InitProcess();
|
||||||
bool InitThread();
|
bool InitThread();
|
||||||
|
bool DetachThread(); // not called from standalone, perhaps other tools rely on parts of it
|
||||||
|
bool DetachProcess(); // not called from standalone, perhaps other tools rely on parts of it
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ namespace glslang {
|
|||||||
//
|
//
|
||||||
static void DetachThreadLinux(void *)
|
static void DetachThreadLinux(void *)
|
||||||
{
|
{
|
||||||
|
DetachThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user