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