1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-01 03:10:06 +00:00

Replaced calls to the deprecated unix siginterrupt function.

This commit is contained in:
jules 2013-07-08 15:06:03 +01:00
parent 7293044a73
commit 4346fdb5f5
3 changed files with 20 additions and 3 deletions

View file

@ -37,7 +37,7 @@ public:
stopReadOperation (false)
{
signal (SIGPIPE, signalHandler);
siginterrupt (SIGPIPE, 1);
juce_siginterrupt (SIGPIPE, 1);
}
~Pimpl()

View file

@ -179,6 +179,21 @@ bool File::setAsCurrentWorkingDirectory() const
return chdir (getFullPathName().toUTF8()) == 0;
}
//==============================================================================
// The unix siginterrupt function is deprecated - this does the same job.
int juce_siginterrupt (int sig, int flag)
{
struct ::sigaction act;
(void) ::sigaction (sig, nullptr, &act);
if (flag != 0)
act.sa_flags &= ~SA_RESTART;
else
act.sa_flags |= SA_RESTART;
return ::sigaction (sig, &act, nullptr);
}
//==============================================================================
namespace
{

View file

@ -84,7 +84,7 @@ String SystemStats::getStackBacktrace()
int frames = (int) CaptureStackBackTrace (0, numElementsInArray (stack), stack, nullptr);
HeapBlock<SYMBOL_INFO> symbol;
symbol.calloc (sizeof(SYMBOL_INFO) + 256, 1);
symbol.calloc (sizeof (SYMBOL_INFO) + 256, 1);
symbol->MaxNameLen = 255;
symbol->SizeOfStruct = sizeof (SYMBOL_INFO);
@ -136,6 +136,8 @@ static void handleCrash (int)
globalCrashHandler();
kill (getpid(), SIGKILL);
}
int juce_siginterrupt (int sig, int flag);
#endif
void SystemStats::setApplicationCrashHandler (CrashHandlerFunction handler)
@ -151,7 +153,7 @@ void SystemStats::setApplicationCrashHandler (CrashHandlerFunction handler)
for (int i = 0; i < numElementsInArray (signals); ++i)
{
::signal (signals[i], handleCrash);
::siginterrupt (signals[i], 1);
juce_siginterrupt (signals[i], 1);
}
#endif
}