aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authorprout <prout@yandex-team.ru>2022-02-10 16:49:43 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:43 +0300
commitd2247f243d31adde8feb765324e40c83c5a90999 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/system
parent7b7fa28b9099b7adca890459a699c6ba5eeff4ca (diff)
downloadydb-d2247f243d31adde8feb765324e40c83c5a90999.tar.gz
Restoring authorship annotation for <prout@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/guard.h20
-rw-r--r--util/system/pipe.cpp8
-rw-r--r--util/system/pipe.h4
-rw-r--r--util/system/rwlock.cpp16
-rw-r--r--util/system/thread.cpp12
-rw-r--r--util/system/thread.h12
6 files changed, 36 insertions, 36 deletions
diff --git a/util/system/guard.h b/util/system/guard.h
index 0bb93f0b88..efc091d5f8 100644
--- a/util/system/guard.h
+++ b/util/system/guard.h
@@ -21,19 +21,19 @@ struct TTryLockOps: public TCommonLockOps<T> {
};
//must be used with great care
-template <class TOps>
+template <class TOps>
struct TInverseLockOps: public TOps {
- template <class T>
+ template <class T>
static inline void Acquire(T* t) noexcept {
- TOps::Release(t);
- }
-
- template <class T>
+ TOps::Release(t);
+ }
+
+ template <class T>
static inline void Release(T* t) noexcept {
- TOps::Acquire(t);
- }
-};
-
+ TOps::Acquire(t);
+ }
+};
+
template <class T, class TOps = TCommonLockOps<T>>
class TGuard: public TNonCopyable {
public:
diff --git a/util/system/pipe.cpp b/util/system/pipe.cpp
index 1d098e8966..a543bd7472 100644
--- a/util/system/pipe.cpp
+++ b/util/system/pipe.cpp
@@ -98,7 +98,7 @@ public:
return Handle_;
}
- size_t Read(void* buffer, size_t count) const {
+ size_t Read(void* buffer, size_t count) const {
ssize_t r = Handle_.Read(buffer, count);
if (r < 0) {
ythrow TFileError() << "failed to read from pipe";
@@ -106,7 +106,7 @@ public:
return r;
}
- size_t Write(const void* buffer, size_t count) const {
+ size_t Write(const void* buffer, size_t count) const {
ssize_t r = Handle_.Write(buffer, count);
if (r < 0) {
ythrow TFileError() << "failed to write to pipe";
@@ -142,11 +142,11 @@ bool TPipe::IsOpen() const noexcept {
return Impl_->IsOpen();
}
-size_t TPipe::Read(void* buf, size_t len) const {
+size_t TPipe::Read(void* buf, size_t len) const {
return Impl_->Read(buf, len);
}
-size_t TPipe::Write(const void* buf, size_t len) const {
+size_t TPipe::Write(const void* buf, size_t len) const {
return Impl_->Write(buf, len);
}
diff --git a/util/system/pipe.h b/util/system/pipe.h
index c56dd1b4ae..75d0360049 100644
--- a/util/system/pipe.h
+++ b/util/system/pipe.h
@@ -73,8 +73,8 @@ public:
bool IsOpen() const noexcept;
PIPEHANDLE GetHandle() const noexcept;
- size_t Read(void* buf, size_t len) const;
- size_t Write(const void* buf, size_t len) const;
+ size_t Read(void* buf, size_t len) const;
+ size_t Write(const void* buf, size_t len) const;
// Only CloseOnExec is supported
static void Pipe(TPipe& reader, TPipe& writer, EOpenMode mode = 0);
diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp
index a4ac69fad6..bb3dcbf188 100644
--- a/util/system/rwlock.cpp
+++ b/util/system/rwlock.cpp
@@ -171,44 +171,44 @@ TRWMutex::TImpl::TImpl() {
}
TRWMutex::TImpl::~TImpl() {
- const int result = pthread_rwlock_destroy(&Lock_);
+ const int result = pthread_rwlock_destroy(&Lock_);
Y_VERIFY(result == 0, "rwlock destroy failed (%s)", LastSystemErrorText(result));
}
void TRWMutex::TImpl::AcquireRead() noexcept {
- const int result = pthread_rwlock_rdlock(&Lock_);
+ const int result = pthread_rwlock_rdlock(&Lock_);
Y_VERIFY(result == 0, "rwlock rdlock failed (%s)", LastSystemErrorText(result));
}
bool TRWMutex::TImpl::TryAcquireRead() noexcept {
- const int result = pthread_rwlock_tryrdlock(&Lock_);
+ const int result = pthread_rwlock_tryrdlock(&Lock_);
Y_VERIFY(result == 0 || result == EBUSY, "rwlock tryrdlock failed (%s)", LastSystemErrorText(result));
return result == 0;
}
void TRWMutex::TImpl::ReleaseRead() noexcept {
- const int result = pthread_rwlock_unlock(&Lock_);
+ const int result = pthread_rwlock_unlock(&Lock_);
Y_VERIFY(result == 0, "rwlock (read) unlock failed (%s)", LastSystemErrorText(result));
}
void TRWMutex::TImpl::AcquireWrite() noexcept {
- const int result = pthread_rwlock_wrlock(&Lock_);
+ const int result = pthread_rwlock_wrlock(&Lock_);
Y_VERIFY(result == 0, "rwlock wrlock failed (%s)", LastSystemErrorText(result));
}
bool TRWMutex::TImpl::TryAcquireWrite() noexcept {
- const int result = pthread_rwlock_trywrlock(&Lock_);
+ const int result = pthread_rwlock_trywrlock(&Lock_);
Y_VERIFY(result == 0 || result == EBUSY, "rwlock trywrlock failed (%s)", LastSystemErrorText(result));
return result == 0;
}
void TRWMutex::TImpl::ReleaseWrite() noexcept {
- const int result = pthread_rwlock_unlock(&Lock_);
+ const int result = pthread_rwlock_unlock(&Lock_);
Y_VERIFY(result == 0, "rwlock (write) unlock failed (%s)", LastSystemErrorText(result));
}
void TRWMutex::TImpl::Release() noexcept {
- const int result = pthread_rwlock_unlock(&Lock_);
+ const int result = pthread_rwlock_unlock(&Lock_);
Y_VERIFY(result == 0, "rwlock unlock failed (%s)", LastSystemErrorText(result));
}
diff --git a/util/system/thread.cpp b/util/system/thread.cpp
index 2d32e9ee8f..6236746c2d 100644
--- a/util/system/thread.cpp
+++ b/util/system/thread.cpp
@@ -355,18 +355,18 @@ TThread::TId TThread::CurrentThreadNumericId() noexcept {
TThread::TId TThread::ImpossibleThreadId() noexcept {
return Max<TThread::TId>();
}
-
-namespace {
+
+namespace {
template <class T>
static void* ThreadProcWrapper(void* param) {
return reinterpret_cast<T*>(param)->ThreadProc();
}
-}
-
+}
+
ISimpleThread::ISimpleThread(size_t stackSize)
: TThread(TParams(ThreadProcWrapper<ISimpleThread>, reinterpret_cast<void*>(this), stackSize))
-{
-}
+{
+}
#if defined(_MSC_VER)
// This beautiful piece of code is borrowed from
diff --git a/util/system/thread.h b/util/system/thread.h
index 3040ca59de..a6e8abdb5b 100644
--- a/util/system/thread.h
+++ b/util/system/thread.h
@@ -28,7 +28,7 @@ public:
void* StackPointer;
// See comments for `SetCurrentThreadName`
TString Name = GetProgramName();
-
+
inline TParams()
: Proc(nullptr)
, Data(nullptr)
@@ -36,7 +36,7 @@ public:
, StackPointer(nullptr)
{
}
-
+
inline TParams(TThreadProc proc, void* data)
: Proc(proc)
, Data(data)
@@ -156,15 +156,15 @@ private:
class TImpl;
THolder<TImpl> Impl_;
};
-
+
class ISimpleThread: public TThread {
public:
ISimpleThread(size_t stackSize = 0);
-
+
virtual ~ISimpleThread() = default;
-
+
virtual void* ThreadProc() = 0;
-};
+};
struct TCurrentThreadLimits {
TCurrentThreadLimits() noexcept;