0.2.0-dev Download ZIP
140 lines ·5.2 KB Raw
| 1 | diff --git a/thirdparty/mingw-std-threads/mingw.condition_variable.h b/thirdparty/mingw-std-threads/mingw.condition_variable.h |
| 2 | index 05086ac429..d099fad2ec 100644 |
| 3 | --- a/thirdparty/mingw-std-threads/mingw.condition_variable.h |
| 4 | +++ b/thirdparty/mingw-std-threads/mingw.condition_variable.h |
| 5 | @@ -87,12 +87,12 @@ public: |
| 6 | : mSemaphore(CreateSemaphoreA(NULL, 0, 0xFFFF, NULL)) |
| 7 | { |
| 8 | if (mSemaphore == NULL) |
| 9 | - throw std::system_error(GetLastError(), std::generic_category()); |
| 10 | + __builtin_trap(); |
| 11 | mWakeEvent = CreateEvent(NULL, FALSE, FALSE, NULL); |
| 12 | if (mWakeEvent == NULL) |
| 13 | { |
| 14 | CloseHandle(mSemaphore); |
| 15 | - throw std::system_error(GetLastError(), std::generic_category()); |
| 16 | + __builtin_trap(); |
| 17 | } |
| 18 | } |
| 19 | ~condition_variable_any() |
| 20 | @@ -132,7 +132,7 @@ private: |
| 21 | else |
| 22 | { |
| 23 | using namespace std; |
| 24 | - throw system_error(make_error_code(errc::protocol_error)); |
| 25 | + __builtin_trap(); |
| 26 | } |
| 27 | } |
| 28 | public: |
| 29 | diff --git a/thirdparty/mingw-std-threads/mingw.mutex.h b/thirdparty/mingw-std-threads/mingw.mutex.h |
| 30 | index 3bf9bd02a7..1e881e6c7d 100644 |
| 31 | --- a/thirdparty/mingw-std-threads/mingw.mutex.h |
| 32 | +++ b/thirdparty/mingw-std-threads/mingw.mutex.h |
| 33 | @@ -132,7 +132,7 @@ struct _OwnerThread |
| 34 | fprintf(stderr, "FATAL: Recursive locking of non-recursive mutex\ |
| 35 | detected. Throwing system exception\n"); |
| 36 | fflush(stderr); |
| 37 | - throw system_error(make_error_code(errc::resource_deadlock_would_occur)); |
| 38 | + __builtin_trap(); |
| 39 | } |
| 40 | DWORD checkOwnerBeforeLock() const |
| 41 | { |
| 42 | @@ -364,13 +364,13 @@ public: |
| 43 | #endif |
| 44 | if ((ret != kWaitObject0) && (ret != kWaitAbandoned)) |
| 45 | { |
| 46 | - throw std::system_error(GetLastError(), std::system_category()); |
| 47 | + __builtin_trap(); |
| 48 | } |
| 49 | } |
| 50 | void unlock() |
| 51 | { |
| 52 | if (!ReleaseMutex(mHandle)) |
| 53 | - throw std::system_error(GetLastError(), std::system_category()); |
| 54 | + __builtin_trap(); |
| 55 | } |
| 56 | bool try_lock() |
| 57 | { |
| 58 | diff --git a/thirdparty/mingw-std-threads/mingw.shared_mutex.h b/thirdparty/mingw-std-threads/mingw.shared_mutex.h |
| 59 | index de89b57966..ddc46bb826 100644 |
| 60 | --- a/thirdparty/mingw-std-threads/mingw.shared_mutex.h |
| 61 | +++ b/thirdparty/mingw-std-threads/mingw.shared_mutex.h |
| 62 | @@ -134,7 +134,7 @@ public: |
| 63 | using namespace std; |
| 64 | #ifndef NDEBUG |
| 65 | if (!(mCounter.fetch_sub(1, memory_order_release) & static_cast<counter_type>(~kWriteBit))) |
| 66 | - throw system_error(make_error_code(errc::operation_not_permitted)); |
| 67 | + __builtin_trap(); |
| 68 | #else |
| 69 | mCounter.fetch_sub(1, memory_order_release); |
| 70 | #endif |
| 71 | @@ -187,7 +187,7 @@ public: |
| 72 | using namespace std; |
| 73 | #ifndef NDEBUG |
| 74 | if (mCounter.load(memory_order_relaxed) != kWriteBit) |
| 75 | - throw system_error(make_error_code(errc::operation_not_permitted)); |
| 76 | + __builtin_trap(); |
| 77 | #endif |
| 78 | mCounter.store(0, memory_order_release); |
| 79 | } |
| 80 | @@ -317,9 +317,9 @@ class shared_lock |
| 81 | { |
| 82 | using namespace std; |
| 83 | if (mMutex == nullptr) |
| 84 | - throw system_error(make_error_code(errc::operation_not_permitted)); |
| 85 | + __builtin_trap(); |
| 86 | if (mOwns) |
| 87 | - throw system_error(make_error_code(errc::resource_deadlock_would_occur)); |
| 88 | + __builtin_trap(); |
| 89 | } |
| 90 | public: |
| 91 | typedef Mutex mutex_type; |
| 92 | @@ -432,7 +432,7 @@ public: |
| 93 | { |
| 94 | using namespace std; |
| 95 | if (!mOwns) |
| 96 | - throw system_error(make_error_code(errc::operation_not_permitted)); |
| 97 | + __builtin_trap(); |
| 98 | mMutex->unlock_shared(); |
| 99 | mOwns = false; |
| 100 | } |
| 101 | diff --git a/thirdparty/mingw-std-threads/mingw.thread.h b/thirdparty/mingw-std-threads/mingw.thread.h |
| 102 | index 011c2d8c56..60d2200db2 100644 |
| 103 | --- a/thirdparty/mingw-std-threads/mingw.thread.h |
| 104 | +++ b/thirdparty/mingw-std-threads/mingw.thread.h |
| 105 | @@ -193,10 +193,9 @@ public: |
| 106 | if (int_handle == 0) |
| 107 | { |
| 108 | mHandle = kInvalidHandle; |
| 109 | - int errnum = errno; |
| 110 | delete call; |
| 111 | // Note: Should only throw EINVAL, EAGAIN, EACCES |
| 112 | - throw std::system_error(errnum, std::generic_category()); |
| 113 | + __builtin_trap(); |
| 114 | } else { |
| 115 | mThreadId.mId = id_receiver; |
| 116 | mHandle = reinterpret_cast<HANDLE>(int_handle); |
| 117 | @@ -213,11 +212,11 @@ public: |
| 118 | { |
| 119 | using namespace std; |
| 120 | if (get_id() == id(GetCurrentThreadId())) |
| 121 | - throw system_error(make_error_code(errc::resource_deadlock_would_occur)); |
| 122 | + __builtin_trap(); |
| 123 | if (mHandle == kInvalidHandle) |
| 124 | - throw system_error(make_error_code(errc::no_such_process)); |
| 125 | + __builtin_trap(); |
| 126 | if (!joinable()) |
| 127 | - throw system_error(make_error_code(errc::invalid_argument)); |
| 128 | + __builtin_trap(); |
| 129 | WaitForSingleObject(mHandle, kInfinite); |
| 130 | CloseHandle(mHandle); |
| 131 | mHandle = kInvalidHandle; |
| 132 | @@ -266,7 +265,7 @@ moving another thread to it.\n"); |
| 133 | if (!joinable()) |
| 134 | { |
| 135 | using namespace std; |
| 136 | - throw system_error(make_error_code(errc::invalid_argument)); |
| 137 | + __builtin_trap(); |
| 138 | } |
| 139 | if (mHandle != kInvalidHandle) |
| 140 | { |