diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2023-02-16 12:30:27 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2023-02-16 12:30:27 +0300 |
commit | 2d466cb51cdcc7a2de1685144bc5c2a6794d825e (patch) | |
tree | 4734b1ddfd4208c004f5caa9f07cd04ea65a8f60 /contrib/libs/re2/util | |
parent | a550b15e307f7b41ef2cca24df4a4fd80efdbbc6 (diff) | |
download | ydb-2d466cb51cdcc7a2de1685144bc5c2a6794d825e.tar.gz |
Update contrib/libs/re2 to 2023-02-01
Diffstat (limited to 'contrib/libs/re2/util')
-rw-r--r-- | contrib/libs/re2/util/mutex.h | 20 | ||||
-rw-r--r-- | contrib/libs/re2/util/pcre.h | 2 |
2 files changed, 19 insertions, 3 deletions
diff --git a/contrib/libs/re2/util/mutex.h b/contrib/libs/re2/util/mutex.h index 4b6772ae22..57c573205d 100644 --- a/contrib/libs/re2/util/mutex.h +++ b/contrib/libs/re2/util/mutex.h @@ -10,6 +10,10 @@ * You should assume the locks are *not* re-entrant. */ +#ifdef RE2_NO_THREADS +#include <assert.h> +#define MUTEX_IS_LOCK_COUNTER +#else #ifdef _WIN32 // Requires Windows Vista or Windows Server 2008 at minimum. #include <windows.h> @@ -25,8 +29,11 @@ #define MUTEX_IS_PTHREAD_RWLOCK #endif #endif +#endif -#if defined(MUTEX_IS_WIN32_SRWLOCK) +#if defined(MUTEX_IS_LOCK_COUNTER) +typedef int MutexType; +#elif defined(MUTEX_IS_WIN32_SRWLOCK) typedef SRWLOCK MutexType; #elif defined(MUTEX_IS_PTHREAD_RWLOCK) #include <pthread.h> @@ -64,7 +71,16 @@ class Mutex { Mutex& operator=(const Mutex&) = delete; }; -#if defined(MUTEX_IS_WIN32_SRWLOCK) +#if defined(MUTEX_IS_LOCK_COUNTER) + +Mutex::Mutex() : mutex_(0) { } +Mutex::~Mutex() { assert(mutex_ == 0); } +void Mutex::Lock() { assert(--mutex_ == -1); } +void Mutex::Unlock() { assert(mutex_++ == -1); } +void Mutex::ReaderLock() { assert(++mutex_ > 0); } +void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } + +#elif defined(MUTEX_IS_WIN32_SRWLOCK) Mutex::Mutex() : mutex_(SRWLOCK_INIT) { } Mutex::~Mutex() { } diff --git a/contrib/libs/re2/util/pcre.h b/contrib/libs/re2/util/pcre.h index 896b0bdf89..f0a7180384 100644 --- a/contrib/libs/re2/util/pcre.h +++ b/contrib/libs/re2/util/pcre.h @@ -500,7 +500,7 @@ class PCRE { bool report_errors_; // Silences error logging if false int match_limit_; // Limit on execution resources int stack_limit_; // Limit on stack resources (bytes) - mutable int32_t hit_limit_; // Hit limit during execution (bool) + mutable int hit_limit_; // Hit limit during execution (bool) PCRE(const PCRE&) = delete; PCRE& operator=(const PCRE&) = delete; |