diff options
Diffstat (limited to 'lib/System/Unix/Signals.inc')
-rw-r--r-- | lib/System/Unix/Signals.inc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/System/Unix/Signals.inc b/lib/System/Unix/Signals.inc index 3e0de66..997d478 100644 --- a/lib/System/Unix/Signals.inc +++ b/lib/System/Unix/Signals.inc @@ -182,6 +182,16 @@ bool llvm::sys::RemoveFileOnSignal(const sys::Path &Filename, return false; } +// DontRemoveFileOnSignal - The public API +void llvm::sys::DontRemoveFileOnSignal(const sys::Path &Filename) { + SignalsMutex.acquire(); + std::vector<sys::Path>::reverse_iterator I = + std::find(FilesToRemove.rbegin(), FilesToRemove.rend(), Filename); + if (I != FilesToRemove.rend()) + FilesToRemove.erase(I.base()-1); + SignalsMutex.release(); +} + /// AddSignalHandler - Add a function to be called when a signal is delivered /// to the process. The handler can have a cookie passed to it to identify /// what instance of the handler it is. @@ -264,6 +274,10 @@ void llvm::sys::PrintStackTraceOnErrorSignal() { #ifdef __APPLE__ +int raise(int sig) { + return pthread_kill(pthread_self(), sig); +} + void __assert_rtn(const char *func, const char *file, int line, @@ -281,7 +295,7 @@ void __assert_rtn(const char *func, #include <pthread.h> void abort() { - pthread_kill(pthread_self(), SIGABRT); + raise(SIGABRT); usleep(1000); __builtin_trap(); } |