aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/condvar.cpp
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/condvar.cpp
parent2bf39531b4f50b889e946ac4866018678a4fb281 (diff)
downloadydb-6ab7e5f5ada0643a48d393717f443bd548706ffc.tar.gz
Restoring authorship annotation for <tejblum@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/condvar.cpp')
-rw-r--r--util/system/condvar.cpp26
1 files changed, 13 insertions, 13 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);
-}
+}