Path: blob/master/thirdparty/mingw-std-threads/patches/0001-disable-exceptions.patch
9903 views
diff --git a/thirdparty/mingw-std-threads/mingw.condition_variable.h b/thirdparty/mingw-std-threads/mingw.condition_variable.h1index 05086ac429..d099fad2ec 1006442--- a/thirdparty/mingw-std-threads/mingw.condition_variable.h3+++ b/thirdparty/mingw-std-threads/mingw.condition_variable.h4@@ -87,12 +87,12 @@ public:5: mSemaphore(CreateSemaphoreA(NULL, 0, 0xFFFF, NULL))6{7if (mSemaphore == NULL)8- throw std::system_error(GetLastError(), std::generic_category());9+ __builtin_trap();10mWakeEvent = CreateEvent(NULL, FALSE, FALSE, NULL);11if (mWakeEvent == NULL)12{13CloseHandle(mSemaphore);14- throw std::system_error(GetLastError(), std::generic_category());15+ __builtin_trap();16}17}18~condition_variable_any()19@@ -132,7 +132,7 @@ private:20else21{22using namespace std;23- throw system_error(make_error_code(errc::protocol_error));24+ __builtin_trap();25}26}27public:28diff --git a/thirdparty/mingw-std-threads/mingw.mutex.h b/thirdparty/mingw-std-threads/mingw.mutex.h29index 3bf9bd02a7..1e881e6c7d 10064430--- a/thirdparty/mingw-std-threads/mingw.mutex.h31+++ b/thirdparty/mingw-std-threads/mingw.mutex.h32@@ -132,7 +132,7 @@ struct _OwnerThread33fprintf(stderr, "FATAL: Recursive locking of non-recursive mutex\34detected. Throwing system exception\n");35fflush(stderr);36- throw system_error(make_error_code(errc::resource_deadlock_would_occur));37+ __builtin_trap();38}39DWORD checkOwnerBeforeLock() const40{41@@ -364,13 +364,13 @@ public:42#endif43if ((ret != kWaitObject0) && (ret != kWaitAbandoned))44{45- throw std::system_error(GetLastError(), std::system_category());46+ __builtin_trap();47}48}49void unlock()50{51if (!ReleaseMutex(mHandle))52- throw std::system_error(GetLastError(), std::system_category());53+ __builtin_trap();54}55bool try_lock()56{57diff --git a/thirdparty/mingw-std-threads/mingw.shared_mutex.h b/thirdparty/mingw-std-threads/mingw.shared_mutex.h58index de89b57966..ddc46bb826 10064459--- a/thirdparty/mingw-std-threads/mingw.shared_mutex.h60+++ b/thirdparty/mingw-std-threads/mingw.shared_mutex.h61@@ -134,7 +134,7 @@ public:62using namespace std;63#ifndef NDEBUG64if (!(mCounter.fetch_sub(1, memory_order_release) & static_cast<counter_type>(~kWriteBit)))65- throw system_error(make_error_code(errc::operation_not_permitted));66+ __builtin_trap();67#else68mCounter.fetch_sub(1, memory_order_release);69#endif70@@ -187,7 +187,7 @@ public:71using namespace std;72#ifndef NDEBUG73if (mCounter.load(memory_order_relaxed) != kWriteBit)74- throw system_error(make_error_code(errc::operation_not_permitted));75+ __builtin_trap();76#endif77mCounter.store(0, memory_order_release);78}79@@ -317,9 +317,9 @@ class shared_lock80{81using namespace std;82if (mMutex == nullptr)83- throw system_error(make_error_code(errc::operation_not_permitted));84+ __builtin_trap();85if (mOwns)86- throw system_error(make_error_code(errc::resource_deadlock_would_occur));87+ __builtin_trap();88}89public:90typedef Mutex mutex_type;91@@ -432,7 +432,7 @@ public:92{93using namespace std;94if (!mOwns)95- throw system_error(make_error_code(errc::operation_not_permitted));96+ __builtin_trap();97mMutex->unlock_shared();98mOwns = false;99}100diff --git a/thirdparty/mingw-std-threads/mingw.thread.h b/thirdparty/mingw-std-threads/mingw.thread.h101index 011c2d8c56..60d2200db2 100644102--- a/thirdparty/mingw-std-threads/mingw.thread.h103+++ b/thirdparty/mingw-std-threads/mingw.thread.h104@@ -193,10 +193,9 @@ public:105if (int_handle == 0)106{107mHandle = kInvalidHandle;108- int errnum = errno;109delete call;110// Note: Should only throw EINVAL, EAGAIN, EACCES111- throw std::system_error(errnum, std::generic_category());112+ __builtin_trap();113} else {114mThreadId.mId = id_receiver;115mHandle = reinterpret_cast<HANDLE>(int_handle);116@@ -213,11 +212,11 @@ public:117{118using namespace std;119if (get_id() == id(GetCurrentThreadId()))120- throw system_error(make_error_code(errc::resource_deadlock_would_occur));121+ __builtin_trap();122if (mHandle == kInvalidHandle)123- throw system_error(make_error_code(errc::no_such_process));124+ __builtin_trap();125if (!joinable())126- throw system_error(make_error_code(errc::invalid_argument));127+ __builtin_trap();128WaitForSingleObject(mHandle, kInfinite);129CloseHandle(mHandle);130mHandle = kInvalidHandle;131@@ -266,7 +265,7 @@ moving another thread to it.\n");132if (!joinable())133{134using namespace std;135- throw system_error(make_error_code(errc::invalid_argument));136+ __builtin_trap();137}138if (mHandle != kInvalidHandle)139{140141142