[llvm-commits] [llvm] r112705 - in /llvm/trunk: include/llvm/System/Signals.h lib/System/Unix/Signals.inc lib/System/Win32/Signals.inc
Dan Gohman
gohman at apple.com
Wed Sep 1 07:17:34 PDT 2010
Author: djg
Date: Wed Sep 1 09:17:34 2010
New Revision: 112705
URL: http://llvm.org/viewvc/llvm-project?rev=112705&view=rev
Log:
Add an interface for unregistering a file from the FilesToRemove list.
Modified:
llvm/trunk/include/llvm/System/Signals.h
llvm/trunk/lib/System/Unix/Signals.inc
llvm/trunk/lib/System/Win32/Signals.inc
Modified: llvm/trunk/include/llvm/System/Signals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Signals.h?rev=112705&r1=112704&r2=112705&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Signals.h (original)
+++ llvm/trunk/include/llvm/System/Signals.h Wed Sep 1 09:17:34 2010
@@ -29,6 +29,10 @@
/// @brief Remove a file if a fatal signal occurs.
bool RemoveFileOnSignal(const Path &Filename, std::string* ErrMsg = 0);
+ /// This function removes a file from the list of files to be removed on
+ /// signal delivery.
+ void DontRemoveFileOnSignal(const Path &Filename);
+
/// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
/// process, print a stack trace and then exit.
/// @brief Print a stack trace if a fatal signal occurs.
Modified: llvm/trunk/lib/System/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Signals.inc?rev=112705&r1=112704&r2=112705&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Signals.inc (original)
+++ llvm/trunk/lib/System/Unix/Signals.inc Wed Sep 1 09:17:34 2010
@@ -182,6 +182,16 @@
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.
Modified: llvm/trunk/lib/System/Win32/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Signals.inc?rev=112705&r1=112704&r2=112705&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Signals.inc (original)
+++ llvm/trunk/lib/System/Win32/Signals.inc Wed Sep 1 09:17:34 2010
@@ -140,6 +140,20 @@
return false;
}
+// DontRemoveFileOnSignal - The public API
+void sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
+ if (FilesToRemove == NULL)
+ return;
+
+ FilesToRemove->push_back(Filename);
+ std::vector<sys::Path>::reverse_iterator I =
+ std::find(FilesToRemove->rbegin(), FilesToRemove->rend(), Filename);
+ if (I != FilesToRemove->rend())
+ FilesToRemove->erase(I.base()-1);
+
+ LeaveCriticalSection(&CriticalSection);
+}
+
/// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or
/// SIGSEGV) is delivered to the process, print a stack trace and then exit.
void sys::PrintStackTraceOnErrorSignal() {
More information about the llvm-commits
mailing list