llvm.org GIT mirror llvm / 4115411
Add an interface for unregistering a file from the FilesToRemove list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112705 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
3 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2828 /// @brief Remove a file if a fatal signal occurs.
2929 bool RemoveFileOnSignal(const Path &Filename, std::string* ErrMsg = 0);
3030
31 /// This function removes a file from the list of files to be removed on
32 /// signal delivery.
33 void DontRemoveFileOnSignal(const Path &Filename);
34
3135 /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
3236 /// process, print a stack trace and then exit.
3337 /// @brief Print a stack trace if a fatal signal occurs.
179179
180180 RegisterHandlers();
181181 return false;
182 }
183
184 // DontRemoveFileOnSignal - The public API
185 void llvm::sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
186 SignalsMutex.acquire();
187 std::vector::reverse_iterator I =
188 std::find(FilesToRemove.rbegin(), FilesToRemove.rend(), Filename);
189 if (I != FilesToRemove.rend())
190 FilesToRemove.erase(I.base()-1);
191 SignalsMutex.release();
182192 }
183193
184194 /// AddSignalHandler - Add a function to be called when a signal is delivered
139139 return false;
140140 }
141141
142 // DontRemoveFileOnSignal - The public API
143 void sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
144 if (FilesToRemove == NULL)
145 return;
146
147 FilesToRemove->push_back(Filename);
148 std::vector::reverse_iterator I =
149 std::find(FilesToRemove->rbegin(), FilesToRemove->rend(), Filename);
150 if (I != FilesToRemove->rend())
151 FilesToRemove->erase(I.base()-1);
152
153 LeaveCriticalSection(&CriticalSection);
154 }
155
142156 /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or
143157 /// SIGSEGV) is delivered to the process, print a stack trace and then exit.
144158 void sys::PrintStackTraceOnErrorSignal() {