Export of internal Abseil changes

--
17141711ee419daa597a9f31e73721f80143e55a by Gennadiy Rozental <rogeeff@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 401384949

--
ac48584a7b16e8a12e26d49deb6cddec584a20b5 by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 401337785

--
8a51bb7c962845e0707240c5ba12c1b80f6fbbe9 by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 401047691

--
8e18024510869247f3c04c7807c93709eca2322a by Chris Kennelly <ckennelly@google.com>:

Note that SpinLock does not guarantee priorities for wakeups.

PiperOrigin-RevId: 400999238

--
75bc09b5f95fbb74b74d14c370bfb80011e8fb7f by Derek Mauro <dmauro@google.com>:

Add visibility restrictions to some internal targets

PiperOrigin-RevId: 400718253

--
1de5061016bc42cd7be009c9725ed2343ce12e3d by Abseil Team <absl-team@google.com>:

Make it clear that operator<< can also be used in place of ToString when logging absl::Status.

PiperOrigin-RevId: 400248269

--
cda15d9dc6e5cd569de7e5e73f409b72a3caed51 by Abseil Team <absl-team@google.com>:

Minor cleanup

PiperOrigin-RevId: 400087535

--
b001375ec47da3a0434be9ca9a45c0df510e7dda by Abseil Team <absl-team@google.com>:

Move periodic_sampler from base/internal to profiling/internal

PiperOrigin-RevId: 400038533

--
e7e02e686abc3900e723080849a3607d190ef57f by Abseil Team <absl-team@google.com>:

Move exponential_biased from base/internal to profiling/internal

PiperOrigin-RevId: 400020329
GitOrigin-RevId: 17141711ee419daa597a9f31e73721f80143e55a
Change-Id: I10924df7e1cc198447813dbe97a374a5cef66b49
pull/1035/head
Abseil Team 3 years ago committed by rogeeff
parent ae0f4c2660
commit a59b4daa07
  1. 8
      CMake/AbseilDll.cmake
  2. 69
      absl/base/BUILD.bazel
  3. 54
      absl/base/CMakeLists.txt
  4. 4
      absl/base/internal/spinlock.h
  5. 2
      absl/base/internal/spinlock_wait.h
  6. 2
      absl/container/BUILD.bazel
  7. 4
      absl/container/internal/hashtablez_sampler.cc
  8. 2
      absl/debugging/BUILD.bazel
  9. 73
      absl/profiling/BUILD.bazel
  10. 54
      absl/profiling/CMakeLists.txt
  11. 6
      absl/profiling/internal/exponential_biased.cc
  12. 10
      absl/profiling/internal/exponential_biased.h
  13. 6
      absl/profiling/internal/exponential_biased_test.cc
  14. 8
      absl/profiling/internal/periodic_sampler.cc
  15. 14
      absl/profiling/internal/periodic_sampler.h
  16. 6
      absl/profiling/internal/periodic_sampler_benchmark.cc
  17. 6
      absl/profiling/internal/periodic_sampler_test.cc
  18. 2
      absl/status/status.h
  19. 2
      absl/strings/BUILD.bazel
  20. 4
      absl/strings/internal/cordz_functions.cc
  21. 55
      absl/synchronization/mutex_test.cc
  22. 1
      absl/time/internal/cctz/src/cctz_benchmark.cc
  23. 1
      absl/time/internal/cctz/src/time_zone_lookup_test.cc
  24. 2
      absl/time/internal/cctz/testdata/version
  25. BIN
      absl/time/internal/cctz/testdata/zoneinfo/Atlantic/Jan_Mayen

@ -17,8 +17,6 @@ set(ABSL_INTERNAL_DLL_FILES
"base/internal/dynamic_annotations.h"
"base/internal/endian.h"
"base/internal/errno_saver.h"
"base/internal/exponential_biased.cc"
"base/internal/exponential_biased.h"
"base/internal/fast_type_id.h"
"base/internal/hide_ptr.h"
"base/internal/identity.h"
@ -28,8 +26,6 @@ set(ABSL_INTERNAL_DLL_FILES
"base/internal/low_level_alloc.h"
"base/internal/low_level_scheduling.h"
"base/internal/per_thread_tls.h"
"base/internal/periodic_sampler.cc"
"base/internal/periodic_sampler.h"
"base/internal/pretty_function.h"
"base/internal/raw_logging.cc"
"base/internal/raw_logging.h"
@ -133,6 +129,10 @@ set(ABSL_INTERNAL_DLL_FILES
"numeric/int128.h"
"numeric/internal/bits.h"
"numeric/internal/representation.h"
"profiling/internal/exponential_biased.cc"
"profiling/internal/exponential_biased.h"
"profiling/internal/periodic_sampler.cc"
"profiling/internal/periodic_sampler.h"
"profiling/internal/sample_recorder.h"
"random/bernoulli_distribution.h"
"random/beta_distribution.h"

@ -593,75 +593,6 @@ cc_test(
],
)
cc_library(
name = "exponential_biased",
srcs = ["internal/exponential_biased.cc"],
hdrs = ["internal/exponential_biased.h"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl:__subpackages__",
],
deps = [
":config",
":core_headers",
],
)
cc_test(
name = "exponential_biased_test",
size = "small",
srcs = ["internal/exponential_biased_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
":exponential_biased",
"//absl/strings",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "periodic_sampler",
srcs = ["internal/periodic_sampler.cc"],
hdrs = ["internal/periodic_sampler.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":core_headers",
":exponential_biased",
],
)
cc_test(
name = "periodic_sampler_test",
size = "small",
srcs = ["internal/periodic_sampler_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
":core_headers",
":periodic_sampler",
"@com_google_googletest//:gtest_main",
],
)
cc_binary(
name = "periodic_sampler_benchmark",
testonly = 1,
srcs = ["internal/periodic_sampler_benchmark.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
tags = ["benchmark"],
visibility = ["//visibility:private"],
deps = [
":core_headers",
":periodic_sampler",
"@com_github_google_benchmark//:benchmark_main",
],
)
cc_library(
name = "scoped_set_env",
testonly = 1,

@ -519,60 +519,6 @@ absl_cc_test(
GTest::gtest_main
)
absl_cc_library(
NAME
exponential_biased
SRCS
"internal/exponential_biased.cc"
HDRS
"internal/exponential_biased.h"
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
absl::config
absl::core_headers
)
absl_cc_test(
NAME
exponential_biased_test
SRCS
"internal/exponential_biased_test.cc"
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::exponential_biased
absl::strings
GTest::gmock_main
)
absl_cc_library(
NAME
periodic_sampler
SRCS
"internal/periodic_sampler.cc"
HDRS
"internal/periodic_sampler.h"
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
absl::core_headers
absl::exponential_biased
)
absl_cc_test(
NAME
periodic_sampler_test
SRCS
"internal/periodic_sampler_test.cc"
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::core_headers
absl::periodic_sampler
GTest::gmock_main
)
absl_cc_library(
NAME
scoped_set_env

@ -16,13 +16,15 @@
// Most users requiring mutual exclusion should use Mutex.
// SpinLock is provided for use in two situations:
// - for use in code that Mutex itself depends on
// - for use by Abseil internal code that Mutex itself depends on
// - for async signal safety (see below)
// SpinLock is async signal safe. If a spinlock is used within a signal
// handler, all code that acquires the lock must ensure that the signal cannot
// arrive while they are holding the lock. Typically, this is done by blocking
// the signal.
//
// Threads waiting on a SpinLock may be woken in an arbitrary order.
#ifndef ABSL_BASE_INTERNAL_SPINLOCK_H_
#define ABSL_BASE_INTERNAL_SPINLOCK_H_

@ -39,6 +39,8 @@ struct SpinLockWaitTransition {
// satisfying 0<=i<n && trans[i].done, atomically make the transition,
// then return the old value of *w. Make any other atomic transitions
// where !trans[i].done, but continue waiting.
//
// Wakeups for threads blocked on SpinLockWait do not respect priorities.
uint32_t SpinLockWait(std::atomic<uint32_t> *w, int n,
const SpinLockWaitTransition trans[],
SchedulingMode scheduling_mode);

@ -510,9 +510,9 @@ cc_library(
":have_sse",
"//absl/base",
"//absl/base:core_headers",
"//absl/base:exponential_biased",
"//absl/debugging:stacktrace",
"//absl/memory",
"//absl/profiling:exponential_biased",
"//absl/profiling:sample_recorder",
"//absl/synchronization",
"//absl/utility",

@ -21,10 +21,10 @@
#include <limits>
#include "absl/base/attributes.h"
#include "absl/base/internal/exponential_biased.h"
#include "absl/container/internal/have_sse.h"
#include "absl/debugging/stacktrace.h"
#include "absl/memory/memory.h"
#include "absl/profiling/internal/exponential_biased.h"
#include "absl/profiling/internal/sample_recorder.h"
#include "absl/synchronization/mutex.h"
@ -40,7 +40,7 @@ ABSL_CONST_INIT std::atomic<bool> g_hashtablez_enabled{
ABSL_CONST_INIT std::atomic<int32_t> g_hashtablez_sample_parameter{1 << 10};
#if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
ABSL_PER_THREAD_TLS_KEYWORD absl::base_internal::ExponentialBiased
ABSL_PER_THREAD_TLS_KEYWORD absl::profiling_internal::ExponentialBiased
g_exponential_biased_generator;
#endif

@ -183,6 +183,7 @@ cc_library(
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
"//absl/base:config",
"//absl/base:core_headers",
@ -197,6 +198,7 @@ cc_library(
srcs = ["internal/demangle.cc"],
hdrs = ["internal/demangle.h"],
copts = ABSL_DEFAULT_COPTS,
visibility = ["//visibility:private"],
deps = [
"//absl/base",
"//absl/base:config",

@ -16,6 +16,7 @@ load(
"//absl:copts/configure_copts.bzl",
"ABSL_DEFAULT_COPTS",
"ABSL_DEFAULT_LINKOPTS",
"ABSL_TEST_COPTS",
)
package(default_visibility = ["//visibility:private"])
@ -51,3 +52,75 @@ cc_test(
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "exponential_biased",
srcs = ["internal/exponential_biased.cc"],
hdrs = ["internal/exponential_biased.h"],
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl:__subpackages__",
],
deps = [
"//absl/base:config",
"//absl/base:core_headers",
],
)
cc_test(
name = "exponential_biased_test",
size = "small",
srcs = ["internal/exponential_biased_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
":exponential_biased",
"//absl/strings",
"@com_google_googletest//:gtest_main",
],
)
cc_library(
name = "periodic_sampler",
srcs = ["internal/periodic_sampler.cc"],
hdrs = ["internal/periodic_sampler.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl:__subpackages__",
],
deps = [
":exponential_biased",
"//absl/base:core_headers",
],
)
cc_test(
name = "periodic_sampler_test",
size = "small",
srcs = ["internal/periodic_sampler_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = ["//visibility:private"],
deps = [
":periodic_sampler",
"//absl/base:core_headers",
"@com_google_googletest//:gtest_main",
],
)
cc_binary(
name = "periodic_sampler_benchmark",
testonly = 1,
srcs = ["internal/periodic_sampler_benchmark.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
tags = ["benchmark"],
visibility = ["//visibility:private"],
deps = [
":periodic_sampler",
"//absl/base:core_headers",
"@com_github_google_benchmark//:benchmark_main",
],
)

@ -37,3 +37,57 @@ absl_cc_test(
GTest::gmock_main
)
absl_cc_library(
NAME
exponential_biased
SRCS
"internal/exponential_biased.cc"
HDRS
"internal/exponential_biased.h"
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
absl::config
absl::core_headers
)
absl_cc_test(
NAME
exponential_biased_test
SRCS
"internal/exponential_biased_test.cc"
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::exponential_biased
absl::strings
GTest::gmock_main
)
absl_cc_library(
NAME
periodic_sampler
SRCS
"internal/periodic_sampler.cc"
HDRS
"internal/periodic_sampler.h"
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
absl::core_headers
absl::exponential_biased
)
absl_cc_test(
NAME
periodic_sampler_test
SRCS
"internal/periodic_sampler_test.cc"
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::core_headers
absl::periodic_sampler
GTest::gmock_main
)

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/base/internal/exponential_biased.h"
#include "absl/profiling/internal/exponential_biased.h"
#include <stdint.h>
@ -26,7 +26,7 @@
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace profiling_internal {
// The algorithm generates a random number between 0 and 1 and applies the
// inverse cumulative distribution function for an exponential. Specifically:
@ -88,6 +88,6 @@ void ExponentialBiased::Initialize() {
initialized_ = true;
}
} // namespace base_internal
} // namespace profiling_internal
ABSL_NAMESPACE_END
} // namespace absl

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef ABSL_BASE_INTERNAL_EXPONENTIAL_BIASED_H_
#define ABSL_BASE_INTERNAL_EXPONENTIAL_BIASED_H_
#ifndef ABSL_PROFILING_INTERNAL_EXPONENTIAL_BIASED_H_
#define ABSL_PROFILING_INTERNAL_EXPONENTIAL_BIASED_H_
#include <stdint.h>
@ -22,7 +22,7 @@
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace profiling_internal {
// ExponentialBiased provides a small and fast random number generator for a
// rounded exponential distribution. This generator manages very little state,
@ -123,8 +123,8 @@ inline uint64_t ExponentialBiased::NextRandom(uint64_t rnd) {
return (prng_mult * rnd + prng_add) & prng_mod_mask;
}
} // namespace base_internal
} // namespace profiling_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_BASE_INTERNAL_EXPONENTIAL_BIASED_H_
#endif // ABSL_PROFILING_INTERNAL_EXPONENTIAL_BIASED_H_

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/base/internal/exponential_biased.h"
#include "absl/profiling/internal/exponential_biased.h"
#include <stddef.h>
@ -28,7 +28,7 @@ using ::testing::Ge;
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace profiling_internal {
MATCHER_P2(IsBetween, a, b,
absl::StrCat(std::string(negation ? "isn't" : "is"), " between ", a,
@ -194,6 +194,6 @@ TEST(ExponentialBiasedTest, InitializationModes) {
EXPECT_THAT(eb_stack.GetSkipCount(2), Ge(0));
}
} // namespace base_internal
} // namespace profiling_internal
ABSL_NAMESPACE_END
} // namespace absl

@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/base/internal/periodic_sampler.h"
#include "absl/profiling/internal/periodic_sampler.h"
#include <atomic>
#include "absl/base/internal/exponential_biased.h"
#include "absl/profiling/internal/exponential_biased.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace profiling_internal {
int64_t PeriodicSamplerBase::GetExponentialBiased(int period) noexcept {
return rng_.GetStride(period);
@ -48,6 +48,6 @@ bool PeriodicSamplerBase::SubtleConfirmSample() noexcept {
return true;
}
} // namespace base_internal
} // namespace profiling_internal
ABSL_NAMESPACE_END
} // namespace absl

@ -12,19 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef ABSL_BASE_INTERNAL_PERIODIC_SAMPLER_H_
#define ABSL_BASE_INTERNAL_PERIODIC_SAMPLER_H_
#ifndef ABSL_PROFILING_INTERNAL_PERIODIC_SAMPLER_H_
#define ABSL_PROFILING_INTERNAL_PERIODIC_SAMPLER_H_
#include <stdint.h>
#include <atomic>
#include "absl/base/internal/exponential_biased.h"
#include "absl/base/optimization.h"
#include "absl/profiling/internal/exponential_biased.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace profiling_internal {
// PeriodicSamplerBase provides the basic period sampler implementation.
//
@ -149,7 +149,7 @@ class PeriodicSamplerBase {
// ICC x64 (OK) : https://gcc.godbolt.org/z/ptTNfD
// MSVC x64 (OK) : https://gcc.godbolt.org/z/76j4-5
uint64_t stride_ = 0;
ExponentialBiased rng_;
absl::profiling_internal::ExponentialBiased rng_;
};
inline bool PeriodicSamplerBase::SubtleMaybeSample() noexcept {
@ -204,8 +204,8 @@ class PeriodicSampler final : public PeriodicSamplerBase {
template <typename Tag, int default_period>
std::atomic<int> PeriodicSampler<Tag, default_period>::period_(default_period);
} // namespace base_internal
} // namespace profiling_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_BASE_INTERNAL_PERIODIC_SAMPLER_H_
#endif // ABSL_PROFILING_INTERNAL_PERIODIC_SAMPLER_H_

@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/profiling/internal/periodic_sampler.h"
#include "benchmark/benchmark.h"
#include "absl/base/internal/periodic_sampler.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace profiling_internal {
namespace {
template <typename Sampler>
@ -74,6 +74,6 @@ void BM_PeriodicSampler_Disabled(benchmark::State& state) {
BENCHMARK(BM_PeriodicSampler_Disabled);
} // namespace
} // namespace base_internal
} // namespace profiling_internal
ABSL_NAMESPACE_END
} // namespace absl

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/base/internal/periodic_sampler.h"
#include "absl/profiling/internal/periodic_sampler.h"
#include <thread> // NOLINT(build/c++11)
@ -23,7 +23,7 @@
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
namespace profiling_internal {
namespace {
using testing::Eq;
@ -172,6 +172,6 @@ TEST(PeriodicSamplerTest, SetGlobalPeriod) {
}
} // namespace
} // namespace base_internal
} // namespace profiling_internal
ABSL_NAMESPACE_END
} // namespace absl

@ -494,7 +494,7 @@ class Status final {
// Returns the error message associated with this error code, if available.
// Note that this message rarely describes the error code. It is not unusual
// for the error message to be the empty string. As a result, prefer
// `Status::ToString()` for debug logging.
// `operator<<` or `Status::ToString()` for debug logging.
absl::string_view message() const;
friend bool operator==(const Status&, const Status&);

@ -508,8 +508,8 @@ cc_library(
deps = [
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:exponential_biased",
"//absl/base:raw_logging_internal",
"//absl/profiling:exponential_biased",
],
)

@ -21,8 +21,8 @@
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/exponential_biased.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/profiling/internal/exponential_biased.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@ -48,7 +48,7 @@ constexpr int64_t kIntervalIfDisabled = 1 << 16;
ABSL_ATTRIBUTE_NOINLINE bool cordz_should_profile_slow() {
thread_local absl::base_internal::ExponentialBiased
thread_local absl::profiling_internal::ExponentialBiased
exponential_biased_generator;
int32_t mean_interval = get_cordz_mean_interval();

@ -26,6 +26,7 @@
#include <random>
#include <string>
#include <thread> // NOLINT(build/c++11)
#include <type_traits>
#include <vector>
#include "gtest/gtest.h"
@ -870,33 +871,6 @@ TEST(Mutex, LockedMutexDestructionBug) ABSL_NO_THREAD_SAFETY_ANALYSIS {
}
}
// --------------------------------------------------------
// Test for bug with pattern of readers using a condvar. The bug was that if a
// reader went to sleep on a condition variable while one or more other readers
// held the lock, but there were no waiters, the reader count (held in the
// mutex word) would be lost. (This is because Enqueue() had at one time
// always placed the thread on the Mutex queue. Later (CL 4075610), to
// tolerate re-entry into Mutex from a Condition predicate, Enqueue() was
// changed so that it could also place a thread on a condition-variable. This
// introduced the case where Enqueue() returned with an empty queue, and this
// case was handled incorrectly in one place.)
static void ReaderForReaderOnCondVar(absl::Mutex *mu, absl::CondVar *cv,
int *running) {
std::random_device dev;
std::mt19937 gen(dev());
std::uniform_int_distribution<int> random_millis(0, 15);
mu->ReaderLock();
while (*running == 3) {
absl::SleepFor(absl::Milliseconds(random_millis(gen)));
cv->WaitWithTimeout(mu, absl::Milliseconds(random_millis(gen)));
}
mu->ReaderUnlock();
mu->Lock();
(*running)--;
mu->Unlock();
}
struct True {
template <class... Args>
bool operator()(Args...) const {
@ -945,6 +919,33 @@ TEST(Mutex, FunctorCondition) {
}
}
// --------------------------------------------------------
// Test for bug with pattern of readers using a condvar. The bug was that if a
// reader went to sleep on a condition variable while one or more other readers
// held the lock, but there were no waiters, the reader count (held in the
// mutex word) would be lost. (This is because Enqueue() had at one time
// always placed the thread on the Mutex queue. Later (CL 4075610), to
// tolerate re-entry into Mutex from a Condition predicate, Enqueue() was
// changed so that it could also place a thread on a condition-variable. This
// introduced the case where Enqueue() returned with an empty queue, and this
// case was handled incorrectly in one place.)
static void ReaderForReaderOnCondVar(absl::Mutex *mu, absl::CondVar *cv,
int *running) {
std::random_device dev;
std::mt19937 gen(dev());
std::uniform_int_distribution<int> random_millis(0, 15);
mu->ReaderLock();
while (*running == 3) {
absl::SleepFor(absl::Milliseconds(random_millis(gen)));
cv->WaitWithTimeout(mu, absl::Milliseconds(random_millis(gen)));
}
mu->ReaderUnlock();
mu->Lock();
(*running)--;
mu->Unlock();
}
static bool IntIsZero(int *x) { return *x == 0; }
// Test for reader waiting condition variable when there are other readers

@ -648,6 +648,7 @@ const char* const kTimeZoneNames[] = {"Africa/Abidjan",
"Pacific/Guam",
"Pacific/Honolulu",
"Pacific/Johnston",
"Pacific/Kanton",
"Pacific/Kiritimati",
"Pacific/Kosrae",
"Pacific/Kwajalein",

@ -579,6 +579,7 @@ const char* const kTimeZoneNames[] = {"Africa/Abidjan",
"Pacific/Guam",
"Pacific/Honolulu",
"Pacific/Johnston",
"Pacific/Kanton",
"Pacific/Kiritimati",
"Pacific/Kosrae",
"Pacific/Kwajalein",

Loading…
Cancel
Save