mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-28 08:37:41 +00:00
Cleaning up static initializers in Signals.inc
Reviewed by: Chandlerc git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216704 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
77bf4f97bf
commit
d814e38de8
@ -56,7 +56,6 @@ static std::vector<std::pair<void(*)(void*), void*> > CallBacksToRun;
|
|||||||
static const int IntSigs[] = {
|
static const int IntSigs[] = {
|
||||||
SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2
|
SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2
|
||||||
};
|
};
|
||||||
static const int *const IntSigsEnd = std::end(IntSigs);
|
|
||||||
|
|
||||||
// KillSigs - Signals that represent that we have a bug, and our prompt
|
// KillSigs - Signals that represent that we have a bug, and our prompt
|
||||||
// termination has been ordered.
|
// termination has been ordered.
|
||||||
@ -75,7 +74,6 @@ static const int KillSigs[] = {
|
|||||||
, SIGEMT
|
, SIGEMT
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
static const int *const KillSigsEnd = std::end(KillSigs);
|
|
||||||
|
|
||||||
static unsigned NumRegisteredSignals = 0;
|
static unsigned NumRegisteredSignals = 0;
|
||||||
static struct {
|
static struct {
|
||||||
@ -106,8 +104,8 @@ static void RegisterHandlers() {
|
|||||||
// If the handlers are already registered, we're done.
|
// If the handlers are already registered, we're done.
|
||||||
if (NumRegisteredSignals != 0) return;
|
if (NumRegisteredSignals != 0) return;
|
||||||
|
|
||||||
std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
|
for (auto S : IntSigs) RegisterHandler(S);
|
||||||
std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
|
for (auto S : KillSigs) RegisterHandler(S);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UnregisterHandlers() {
|
static void UnregisterHandlers() {
|
||||||
@ -167,7 +165,8 @@ static RETSIGTYPE SignalHandler(int Sig) {
|
|||||||
unique_lock<SmartMutex<true>> Guard(SignalsMutex);
|
unique_lock<SmartMutex<true>> Guard(SignalsMutex);
|
||||||
RemoveFilesToRemove();
|
RemoveFilesToRemove();
|
||||||
|
|
||||||
if (std::find(IntSigs, IntSigsEnd, Sig) != IntSigsEnd) {
|
if (std::find(std::begin(IntSigs), std::end(IntSigs), Sig)
|
||||||
|
!= std::end(IntSigs)) {
|
||||||
if (InterruptFunction) {
|
if (InterruptFunction) {
|
||||||
void (*IF)() = InterruptFunction;
|
void (*IF)() = InterruptFunction;
|
||||||
Guard.unlock();
|
Guard.unlock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user