diff options
author | Abseil Team <absl-team@google.com> | 2019-09-05T09·54-0700 |
---|---|---|
committer | Gennadiy Rozental <rogeeff@google.com> | 2019-09-05T10·05-0400 |
commit | 83c1d65c90a92aa49632b9ac5a793214bb0768bc (patch) | |
tree | 4ee898954a6400b86daed97c2caaa6f3476be00d /absl/flags/internal/flag.h | |
parent | eb6b7bd23bc0815bfd784e1a74021ce166765280 (diff) |
Export of internal Abseil changes
-- 972333fe1e43427849b8a634aa35061e81be3642 by Abseil Team <absl-team@google.com>: Replace deprecated thread annotations macros. PiperOrigin-RevId: 267332619 -- 7039c6dc499a31c372b4872eda0772455931c360 by Gennadiy Rozental <rogeeff@google.com>: Internal change PiperOrigin-RevId: 267220271 -- a3f524d2afc2535686f206a7ce06961016349d7a by Abseil Team <absl-team@google.com>: Factor kernel_timeout out of synchronization. PiperOrigin-RevId: 267217304 -- 90287de4114ef9a06cafe50256a2d03349772c21 by Abseil Team <absl-team@google.com>: Fixed comment typo. PiperOrigin-RevId: 267198532 -- d312c1a1e52aeca1871ff0deead416d09a7f237e by Gennadiy Rozental <rogeeff@google.com>: Internal change PiperOrigin-RevId: 267185804 GitOrigin-RevId: 972333fe1e43427849b8a634aa35061e81be3642 Change-Id: Ia8a2f877c57cef9854aad48f1753af872fc04dc8
Diffstat (limited to 'absl/flags/internal/flag.h')
-rw-r--r-- | absl/flags/internal/flag.h | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/absl/flags/internal/flag.h b/absl/flags/internal/flag.h index fad36877f74e..a84f7fa8d304 100644 --- a/absl/flags/internal/flag.h +++ b/absl/flags/internal/flag.h @@ -28,23 +28,22 @@ namespace flags_internal { using FlagCallback = void (*)(); void InvokeCallback(absl::Mutex* primary_mu, absl::Mutex* callback_mu, - FlagCallback cb) EXCLUSIVE_LOCKS_REQUIRED(primary_mu); + FlagCallback cb) ABSL_EXCLUSIVE_LOCKS_REQUIRED(primary_mu); // This is "unspecified" implementation of absl::Flag<T> type. template <typename T> class Flag final : public flags_internal::CommandLineFlag { public: - constexpr Flag(const char* name_arg, - const flags_internal::HelpGenFunc help_gen, - const char* filename_arg, - const flags_internal::FlagMarshallingOpFn marshalling_op_arg, + constexpr Flag(const char* name, const flags_internal::HelpGenFunc help_gen, + const char* filename, + const flags_internal::FlagMarshallingOpFn marshalling_op, const flags_internal::InitialValGenFunc initial_value_gen) : flags_internal::CommandLineFlag( - name_arg, flags_internal::HelpText::FromFunctionPointer(help_gen), - filename_arg, &flags_internal::FlagOps<T>, marshalling_op_arg, + name, flags_internal::HelpText::FromFunctionPointer(help_gen), + filename, &flags_internal::FlagOps<T>, marshalling_op, initial_value_gen, - /*def_arg=*/nullptr, - /*cur_arg=*/nullptr), + /*def=*/nullptr, + /*cur=*/nullptr), callback_(nullptr) {} T Get() const { @@ -71,12 +70,12 @@ class Flag final : public flags_internal::CommandLineFlag { }; U u; - this->Read(&u.value, &flags_internal::FlagOps<T>); + Read(&u.value, &flags_internal::FlagOps<T>); return std::move(u.value); } bool AtomicGet(T* v) const { - const int64_t r = this->atomic.load(std::memory_order_acquire); + const int64_t r = atomic_.load(std::memory_order_acquire); if (r != flags_internal::CommandLineFlag::kAtomicInit) { memcpy(v, &r, sizeof(T)); return true; @@ -85,7 +84,7 @@ class Flag final : public flags_internal::CommandLineFlag { return false; } - void Set(const T& v) { this->Write(&v, &flags_internal::FlagOps<T>); } + void Set(const T& v) { Write(&v, &flags_internal::FlagOps<T>); } void SetCallback(const flags_internal::FlagCallback mutation_callback) { absl::MutexLock l(InitFlagIfNecessary()); @@ -95,18 +94,18 @@ class Flag final : public flags_internal::CommandLineFlag { InvokeCallback(); } void InvokeCallback() override - EXCLUSIVE_LOCKS_REQUIRED(this->locks->primary_mu) { - flags_internal::InvokeCallback(&this->locks->primary_mu, - &this->locks->callback_mu, callback_); + ABSL_EXCLUSIVE_LOCKS_REQUIRED(locks_->primary_mu) { + flags_internal::InvokeCallback(&locks_->primary_mu, &locks_->callback_mu, + callback_); } private: void Destroy() const override { // Values are heap allocated Abseil Flags. - if (this->cur) Delete(this->op, this->cur); - if (this->def) Delete(this->op, this->def); + if (cur_) Delete(op_, cur_); + if (def_) Delete(op_, def_); - delete this->locks; + delete locks_; } // Flag's data |