aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authortejblum <tejblum@yandex-team.ru>2022-02-10 16:48:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:02 +0300
commit6ab7e5f5ada0643a48d393717f443bd548706ffc (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /util/system
parent2bf39531b4f50b889e946ac4866018678a4fb281 (diff)
downloadydb-6ab7e5f5ada0643a48d393717f443bd548706ffc.tar.gz
Restoring authorship annotation for <tejblum@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/condvar.cpp26
-rw-r--r--util/system/condvar.h6
-rw-r--r--util/system/defaults.h16
-rw-r--r--util/system/rwlock.cpp20
-rw-r--r--util/system/rwlock.h18
-rw-r--r--util/system/sem.cpp4
-rw-r--r--util/system/tls.cpp2
7 files changed, 46 insertions, 46 deletions
diff --git a/util/system/condvar.cpp b/util/system/condvar.cpp
index 5519bf821a..62f3d22356 100644
--- a/util/system/condvar.cpp
+++ b/util/system/condvar.cpp
@@ -15,8 +15,8 @@
#include <sys/time.h>
#include <pthread.h>
#include <cerrno>
-#endif
-
+#endif
+
namespace {
class TCondVarImpl {
using TLock = TAdaptiveLock;
@@ -85,17 +85,17 @@ public:
ythrow yexception() << "can not create condvar(" << LastSystemErrorText() << ")";
}
}
-
+
inline ~TImpl() {
int ret = pthread_cond_destroy(&Cond_);
Y_VERIFY(ret == 0, "pthread_cond_destroy failed: %s", LastSystemErrorText(ret));
}
-
+
inline void Signal() noexcept {
int ret = pthread_cond_signal(&Cond_);
Y_VERIFY(ret == 0, "pthread_cond_signal failed: %s", LastSystemErrorText(ret));
}
-
+
inline bool WaitD(TMutex& lock, TInstant deadLine) noexcept {
if (deadLine == TInstant::Max()) {
int ret = pthread_cond_wait(&Cond_, (pthread_mutex_t*)lock.Handle());
@@ -116,7 +116,7 @@ public:
return ret == 0;
}
}
-
+
inline void BroadCast() noexcept {
int ret = pthread_cond_broadcast(&Cond_);
Y_VERIFY(ret == 0, "pthread_cond_broadcast failed: %s", LastSystemErrorText(ret));
@@ -126,22 +126,22 @@ private:
pthread_cond_t Cond_;
};
#endif
-
+
TCondVar::TCondVar()
: Impl_(new TImpl)
{
-}
-
+}
+
TCondVar::~TCondVar() = default;
-
+
void TCondVar::BroadCast() noexcept {
Impl_->BroadCast();
}
void TCondVar::Signal() noexcept {
Impl_->Signal();
-}
-
+}
+
bool TCondVar::WaitD(TMutex& mutex, TInstant deadLine) noexcept {
return Impl_->WaitD(mutex, deadLine);
-}
+}
diff --git a/util/system/condvar.h b/util/system/condvar.h
index aae33b2e50..569162717c 100644
--- a/util/system/condvar.h
+++ b/util/system/condvar.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "mutex.h"
#include <util/generic/ptr.h>
@@ -12,10 +12,10 @@ class TCondVar {
public:
TCondVar();
~TCondVar();
-
+
void BroadCast() noexcept;
void Signal() noexcept;
-
+
/*
* returns false if failed by timeout
*/
diff --git a/util/system/defaults.h b/util/system/defaults.h
index 84c4580b02..dcd7abea38 100644
--- a/util/system/defaults.h
+++ b/util/system/defaults.h
@@ -1,7 +1,7 @@
#pragma once
-
+
#include "platform.h"
-
+
#if defined _unix_
#define LOCSLASH_C '/'
#define LOCSLASH_S "/"
@@ -58,12 +58,12 @@
#if defined(__GNUC__)
#define alias_hack __attribute__((__may_alias__))
-#endif
-
-#ifndef alias_hack
+#endif
+
+#ifndef alias_hack
#define alias_hack
-#endif
-
+#endif
+
#include "types.h"
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
@@ -80,7 +80,7 @@
#elif defined(_sun_)
#include <alloca.h>
#endif
-
+
#ifdef NDEBUG
#define Y_IF_DEBUG(X)
#ifdef __cplusplus
diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp
index 66b47e2a7e..bb3dcbf188 100644
--- a/util/system/rwlock.cpp
+++ b/util/system/rwlock.cpp
@@ -1,7 +1,7 @@
-#include "rwlock.h"
+#include "rwlock.h"
#include "mutex.h"
#include "condvar.h"
-
+
#include <util/generic/yexception.h>
#if defined(_unix_)
@@ -39,7 +39,7 @@ TRWMutex::TImpl::TImpl()
, BlockedWriters_(0)
{
}
-
+
TRWMutex::TImpl::~TImpl() {
Y_VERIFY(State_ == 0, "failure, State_ != 0");
Y_VERIFY(BlockedWriters_ == 0, "failure, BlockedWriters_ != 0");
@@ -52,11 +52,11 @@ void TRWMutex::TImpl::AcquireRead() noexcept {
}
++State_;
- }
+ }
ReadCond_.Signal();
}
-
+
bool TRWMutex::TImpl::TryAcquireRead() noexcept {
with_lock (Lock_) {
if (BlockedWriters_ || State_ < 0) {
@@ -128,18 +128,18 @@ void TRWMutex::TImpl::Release() noexcept {
} else if (BlockedWriters_) {
Lock_.Release();
WriteCond_.Signal();
- }
+ }
} else {
State_ = 0;
if (BlockedWriters_) {
Lock_.Release();
WriteCond_.Signal();
- } else {
+ } else {
Lock_.Release();
ReadCond_.Signal();
- }
- }
+ }
+ }
}
#else /* POSIX threads */
@@ -212,7 +212,7 @@ void TRWMutex::TImpl::Release() noexcept {
Y_VERIFY(result == 0, "rwlock unlock failed (%s)", LastSystemErrorText(result));
}
-#endif
+#endif
TRWMutex::TRWMutex()
: Impl_(new TImpl())
diff --git a/util/system/rwlock.h b/util/system/rwlock.h
index c4b28b06a5..0bb9b3fe1c 100644
--- a/util/system/rwlock.h
+++ b/util/system/rwlock.h
@@ -1,25 +1,25 @@
#pragma once
-
+
#include "guard.h"
#include "defaults.h"
-
+
#include <util/generic/ptr.h>
class TRWMutex {
public:
TRWMutex();
~TRWMutex();
-
+
void AcquireRead() noexcept;
bool TryAcquireRead() noexcept;
void ReleaseRead() noexcept;
-
+
void AcquireWrite() noexcept;
bool TryAcquireWrite() noexcept;
void ReleaseWrite() noexcept;
void Release() noexcept;
-
+
private:
class TImpl;
THolder<TImpl> Impl_;
@@ -34,8 +34,8 @@ struct TReadGuardOps {
static inline void Release(T* t) noexcept {
t->ReleaseRead();
}
-};
-
+};
+
template <class T>
struct TTryReadGuardOps: public TReadGuardOps<T> {
static inline bool TryAcquire(T* t) noexcept {
@@ -52,8 +52,8 @@ struct TWriteGuardOps {
static inline void Release(T* t) noexcept {
t->ReleaseWrite();
}
-};
-
+};
+
template <class T>
struct TTryWriteGuardOps: public TWriteGuardOps<T> {
static inline bool TryAcquire(T* t) noexcept {
diff --git a/util/system/sem.cpp b/util/system/sem.cpp
index e291f1423c..4a93b903b5 100644
--- a/util/system/sem.cpp
+++ b/util/system/sem.cpp
@@ -6,8 +6,8 @@
#include <alloca.h>
#endif
-#include <cerrno>
-#include <cstring>
+#include <cerrno>
+#include <cstring>
#ifdef _win_
#include "winint.h"
diff --git a/util/system/tls.cpp b/util/system/tls.cpp
index 5cef5ed235..c2f1a04a14 100644
--- a/util/system/tls.cpp
+++ b/util/system/tls.cpp
@@ -7,7 +7,7 @@
#include <util/generic/intrlist.h>
#include <util/generic/singleton.h>
#include <util/generic/vector.h>
-
+
#if defined(_unix_)
#include <pthread.h>
#endif