aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/rwlock.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/system/rwlock.h
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/rwlock.h')
-rw-r--r--util/system/rwlock.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/util/system/rwlock.h b/util/system/rwlock.h
index d603f5debd..0bb9b3fe1c 100644
--- a/util/system/rwlock.h
+++ b/util/system/rwlock.h
@@ -1,13 +1,13 @@
#pragma once
-#include "guard.h"
-#include "defaults.h"
+#include "guard.h"
+#include "defaults.h"
#include <util/generic/ptr.h>
-class TRWMutex {
-public:
- TRWMutex();
+class TRWMutex {
+public:
+ TRWMutex();
~TRWMutex();
void AcquireRead() noexcept;
@@ -17,44 +17,44 @@ public:
void AcquireWrite() noexcept;
bool TryAcquireWrite() noexcept;
void ReleaseWrite() noexcept;
-
+
void Release() noexcept;
-private:
- class TImpl;
- THolder<TImpl> Impl_;
-};
-
-template <class T>
-struct TReadGuardOps {
+private:
+ class TImpl;
+ THolder<TImpl> Impl_;
+};
+
+template <class T>
+struct TReadGuardOps {
static inline void Acquire(T* t) noexcept {
- t->AcquireRead();
- }
-
+ t->AcquireRead();
+ }
+
static inline void Release(T* t) noexcept {
- t->ReleaseRead();
- }
+ t->ReleaseRead();
+ }
};
-template <class T>
-struct TTryReadGuardOps: public TReadGuardOps<T> {
+template <class T>
+struct TTryReadGuardOps: public TReadGuardOps<T> {
static inline bool TryAcquire(T* t) noexcept {
return t->TryAcquireRead();
}
};
template <class T>
-struct TWriteGuardOps {
+struct TWriteGuardOps {
static inline void Acquire(T* t) noexcept {
- t->AcquireWrite();
- }
-
+ t->AcquireWrite();
+ }
+
static inline void Release(T* t) noexcept {
- t->ReleaseWrite();
- }
+ t->ReleaseWrite();
+ }
};
-template <class T>
+template <class T>
struct TTryWriteGuardOps: public TWriteGuardOps<T> {
static inline bool TryAcquire(T* t) noexcept {
return t->TryAcquireWrite();
@@ -62,17 +62,17 @@ struct TTryWriteGuardOps: public TWriteGuardOps<T> {
};
template <class T>
-using TReadGuardBase = TGuard<T, TReadGuardOps<T>>;
+using TReadGuardBase = TGuard<T, TReadGuardOps<T>>;
template <class T>
using TTryReadGuardBase = TTryGuard<T, TTryReadGuardOps<T>>;
-
-template <class T>
-using TWriteGuardBase = TGuard<T, TWriteGuardOps<T>>;
+
+template <class T>
+using TWriteGuardBase = TGuard<T, TWriteGuardOps<T>>;
template <class T>
using TTryWriteGuardBase = TTryGuard<T, TTryWriteGuardOps<T>>;
-
-using TReadGuard = TReadGuardBase<TRWMutex>;
+
+using TReadGuard = TReadGuardBase<TRWMutex>;
using TTryReadGuard = TTryReadGuardBase<TRWMutex>;
-using TWriteGuard = TWriteGuardBase<TRWMutex>;
+using TWriteGuard = TWriteGuardBase<TRWMutex>;
using TTryWriteGuard = TTryWriteGuardBase<TRWMutex>;