Skip to content

Commit

Permalink
chore: Fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Apr 5, 2024
1 parent 0118ae4 commit 75406e0
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions patch/0002-MUTEX_THROW-and-keep-pragmas.patch
Original file line number Diff line number Diff line change
Expand Up @@ -21,54 +21,3 @@ index f3493601..da4df537 100644
#endif

// Helper for writing global or static RE2s safely.
diff --git a/src/duckdb/third_party/re2/util/mutex.h b/src/duckdb/third_party/re2/util/mutex.h
index 45e590ca..9f2a566c 100644
--- a/src/duckdb/third_party/re2/util/mutex.h
+++ b/src/duckdb/third_party/re2/util/mutex.h
@@ -44,12 +44,18 @@ typedef pthread_rwlock_t MutexType;
typedef std::shared_mutex MutexType;
#endif

+#ifdef MUTEX_IS_PTHREAD_RWLOCK
+#define MUTEX_THROW noexcept(false)
+#else
+#define MUTEX_THROW
+#endif
+
namespace duckdb_re2 {

class Mutex {
public:
- inline Mutex();
- inline ~Mutex();
+ inline Mutex() MUTEX_THROW;
+ inline ~Mutex() MUTEX_THROW;
inline void Lock(); // Block if needed until free then acquire exclusively
inline void Unlock(); // Release a lock acquired via Lock()
// Note that on systems that don't support read-write locks, these may
@@ -93,15 +99,15 @@ void Mutex::ReaderUnlock() { ReleaseSRWLockShared(&mutex_); }

#define SAFE_PTHREAD(fncall) \
do { \
- if ((fncall) != 0) abort(); \
+ if ((fncall) != 0) throw std::runtime_error("re2 mutex pthread error"); \
} while (0)

-Mutex::Mutex() { SAFE_PTHREAD(pthread_rwlock_init(&mutex_, NULL)); }
-Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy(&mutex_)); }
-void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock(&mutex_)); }
-void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }
-void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock(&mutex_)); }
-void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }
+Mutex::Mutex() MUTEX_THROW { SAFE_PTHREAD(pthread_rwlock_init(&mutex_, NULL)); }
+Mutex::~Mutex() MUTEX_THROW { SAFE_PTHREAD(pthread_rwlock_destroy(&mutex_)); }
+void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock(&mutex_)); }
+void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }
+void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock(&mutex_)); }
+void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }

#undef SAFE_PTHREAD

--
2.43.0

0 comments on commit 75406e0

Please sign in to comment.