mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
Fix another hang caused by ManagedStatic in SignalHandler
Fix two other variables that might cause the same hang fixed in r235914. The hang is caused by constructing ManagedStatic in signalhandler. In this case, if FileToRemove or CallBacksToRun is not contructed, it means there is no work to do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
39cf555429
commit
b05b828eab
@ -139,6 +139,11 @@ static void UnregisterHandlers() {
|
||||
/// NB: This must be an async signal safe function. It cannot allocate or free
|
||||
/// memory, even in debug builds.
|
||||
static void RemoveFilesToRemove() {
|
||||
// Avoid constructing ManagedStatic in the signal handler.
|
||||
// If FilesToRemove is not constructed, there are no files to remove.
|
||||
if (!FilesToRemove.isConstructed())
|
||||
return;
|
||||
|
||||
// We avoid iterators in case of debug iterators that allocate or release
|
||||
// memory.
|
||||
std::vector<std::string>& FilesToRemoveRef = *FilesToRemove;
|
||||
@ -200,10 +205,12 @@ static RETSIGTYPE SignalHandler(int Sig) {
|
||||
}
|
||||
|
||||
// Otherwise if it is a fault (like SEGV) run any handler.
|
||||
std::vector<std::pair<void (*)(void *), void *>>& CallBacksToRunRef =
|
||||
*CallBacksToRun;
|
||||
for (unsigned i = 0, e = CallBacksToRun->size(); i != e; ++i)
|
||||
CallBacksToRunRef[i].first(CallBacksToRunRef[i].second);
|
||||
if (CallBacksToRun.isConstructed()) {
|
||||
std::vector<std::pair<void (*)(void *), void *>>& CallBacksToRunRef =
|
||||
*CallBacksToRun;
|
||||
for (unsigned i = 0, e = CallBacksToRun->size(); i != e; ++i)
|
||||
CallBacksToRunRef[i].first(CallBacksToRunRef[i].second);
|
||||
}
|
||||
|
||||
#ifdef __s390__
|
||||
// On S/390, certain signals are delivered with PSW Address pointing to
|
||||
|
Loading…
Reference in New Issue
Block a user