aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp/absl/synchronization
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-02-10 16:45:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:12 +0300
commit49116032d905455a7b1c994e4a696afc885c1e71 (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/restricted/abseil-cpp/absl/synchronization
parent4e839db24a3bbc9f1c610c43d6faaaa99824dcca (diff)
downloadydb-49116032d905455a7b1c994e4a696afc885c1e71.tar.gz
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp/absl/synchronization')
-rw-r--r--contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.cc50
-rw-r--r--contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.h10
-rw-r--r--contrib/restricted/abseil-cpp/absl/synchronization/internal/waiter.cc2
-rw-r--r--contrib/restricted/abseil-cpp/absl/synchronization/mutex.h6
-rw-r--r--contrib/restricted/abseil-cpp/absl/synchronization/ya.make2
5 files changed, 35 insertions, 35 deletions
diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.cc b/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.cc
index cd660b3f0c..d2f82da3bb 100644
--- a/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.cc
+++ b/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.cc
@@ -14,37 +14,37 @@
#include "absl/synchronization/blocking_counter.h"
-#include <atomic>
-
+#include <atomic>
+
#include "absl/base/internal/raw_logging.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
-namespace {
-
-// Return whether int *arg is true.
-bool IsDone(void *arg) { return *reinterpret_cast<bool *>(arg); }
-
-} // namespace
-
-BlockingCounter::BlockingCounter(int initial_count)
- : count_(initial_count),
- num_waiting_(0),
- done_{initial_count == 0 ? true : false} {
- ABSL_RAW_CHECK(initial_count >= 0, "BlockingCounter initial_count negative");
+namespace {
+
+// Return whether int *arg is true.
+bool IsDone(void *arg) { return *reinterpret_cast<bool *>(arg); }
+
+} // namespace
+
+BlockingCounter::BlockingCounter(int initial_count)
+ : count_(initial_count),
+ num_waiting_(0),
+ done_{initial_count == 0 ? true : false} {
+ ABSL_RAW_CHECK(initial_count >= 0, "BlockingCounter initial_count negative");
}
bool BlockingCounter::DecrementCount() {
- int count = count_.fetch_sub(1, std::memory_order_acq_rel) - 1;
- ABSL_RAW_CHECK(count >= 0,
- "BlockingCounter::DecrementCount() called too many times");
- if (count == 0) {
- MutexLock l(&lock_);
- done_ = true;
- return true;
+ int count = count_.fetch_sub(1, std::memory_order_acq_rel) - 1;
+ ABSL_RAW_CHECK(count >= 0,
+ "BlockingCounter::DecrementCount() called too many times");
+ if (count == 0) {
+ MutexLock l(&lock_);
+ done_ = true;
+ return true;
}
- return false;
+ return false;
}
void BlockingCounter::Wait() {
@@ -55,10 +55,10 @@ void BlockingCounter::Wait() {
ABSL_RAW_CHECK(num_waiting_ == 0, "multiple threads called Wait()");
num_waiting_++;
- this->lock_.Await(Condition(IsDone, &this->done_));
+ this->lock_.Await(Condition(IsDone, &this->done_));
- // At this point, we know that all threads executing DecrementCount
- // will not touch this object again.
+ // At this point, we know that all threads executing DecrementCount
+ // will not touch this object again.
// Therefore, the thread calling this method is free to delete the object
// after we return from this method.
}
diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.h b/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.h
index 24d08c3a7b..1908fdb1d9 100644
--- a/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.h
+++ b/contrib/restricted/abseil-cpp/absl/synchronization/blocking_counter.h
@@ -20,8 +20,8 @@
#ifndef ABSL_SYNCHRONIZATION_BLOCKING_COUNTER_H_
#define ABSL_SYNCHRONIZATION_BLOCKING_COUNTER_H_
-#include <atomic>
-
+#include <atomic>
+
#include "absl/base/thread_annotations.h"
#include "absl/synchronization/mutex.h"
@@ -62,7 +62,7 @@ ABSL_NAMESPACE_BEGIN
//
class BlockingCounter {
public:
- explicit BlockingCounter(int initial_count);
+ explicit BlockingCounter(int initial_count);
BlockingCounter(const BlockingCounter&) = delete;
BlockingCounter& operator=(const BlockingCounter&) = delete;
@@ -90,9 +90,9 @@ class BlockingCounter {
private:
Mutex lock_;
- std::atomic<int> count_;
+ std::atomic<int> count_;
int num_waiting_ ABSL_GUARDED_BY(lock_);
- bool done_ ABSL_GUARDED_BY(lock_);
+ bool done_ ABSL_GUARDED_BY(lock_);
};
ABSL_NAMESPACE_END
diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/internal/waiter.cc b/contrib/restricted/abseil-cpp/absl/synchronization/internal/waiter.cc
index d2ccde48b6..28ef311e4a 100644
--- a/contrib/restricted/abseil-cpp/absl/synchronization/internal/waiter.cc
+++ b/contrib/restricted/abseil-cpp/absl/synchronization/internal/waiter.cc
@@ -79,7 +79,7 @@ bool Waiter::Wait(KernelTimeout t) {
// Note that, since the thread ticker is just reset, we don't need to check
// whether the thread is idle on the very first pass of the loop.
bool first_pass = true;
-
+
while (true) {
int32_t x = futex_.load(std::memory_order_relaxed);
while (x != 0) {
diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/mutex.h b/contrib/restricted/abseil-cpp/absl/synchronization/mutex.h
index 23685360b2..38338f24df 100644
--- a/contrib/restricted/abseil-cpp/absl/synchronization/mutex.h
+++ b/contrib/restricted/abseil-cpp/absl/synchronization/mutex.h
@@ -778,9 +778,9 @@ class Condition {
//
// Usage to wake T is:
// mu.Lock();
-// // process data, possibly establishing C
-// if (C) { cv->Signal(); }
-// mu.Unlock();
+// // process data, possibly establishing C
+// if (C) { cv->Signal(); }
+// mu.Unlock();
//
// If C may be useful to more than one waiter, use `SignalAll()` instead of
// `Signal()`.
diff --git a/contrib/restricted/abseil-cpp/absl/synchronization/ya.make b/contrib/restricted/abseil-cpp/absl/synchronization/ya.make
index f05dc9b8da..06f72b69e9 100644
--- a/contrib/restricted/abseil-cpp/absl/synchronization/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/synchronization/ya.make
@@ -21,7 +21,7 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/demangle
contrib/restricted/abseil-cpp/absl/numeric
contrib/restricted/abseil-cpp/absl/strings
- contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal
+ contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal
contrib/restricted/abseil-cpp/absl/synchronization/internal
contrib/restricted/abseil-cpp/absl/time
contrib/restricted/abseil-cpp/absl/time/civil_time