[PATCH] Remove support for runtime multithreading

Chandler Carruth chandlerc at gmail.com
Fri Jun 13 11:54:24 PDT 2014


================
Comment at: lib/Support/ErrorHandling.cpp:70-80
@@ -65,3 +69,13 @@
 void llvm::report_fatal_error(const Twine &Reason, bool GenCrashDiag) {
-  if (ErrorHandler) {
-    ErrorHandler(ErrorHandlerUserData, Reason.str(), GenCrashDiag);
+  llvm::fatal_error_handler_t handler = nullptr;
+  void* handlerData = nullptr;
+  {
+    // The LLVM error handler is likely to call exit(), which should not be done
+    // under a mutex (some mutex implementations exhibit undefined behavior if
+    // destroyed while acquired).  So the mutex is acquired only while reading
+    // the error handler.
+    llvm::MutexGuard Lock(ErrorHandlerMutex);
+    handler = ErrorHandler;
+    handlerData = ErrorHandlerUserData;
+  }
+
----------------
All of this feels like a totally separate thing from removing the runtime control of multithreading.

Can you try to split this up into more isolated changes? I feel like this is still a combined patch of several things that really should be submitted independently.

http://reviews.llvm.org/D4139






More information about the llvm-commits mailing list