[fixit] Make activity_test lighter weight (#30575)

* [activity] Make test lighter weight

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/30599/head
Craig Tiller 3 years ago committed by GitHub
parent 1ed09bd6dc
commit 81ce6aaa5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      test/core/promise/activity_test.cc

@ -360,25 +360,28 @@ TEST(AtomicWakerTest, ThreadStress) {
AtomicWaker waker;
threads.reserve(90);
for (int i = 0; i < 30; i++) {
for (int i = 0; i < 5; i++) {
threads.emplace_back([&] {
while (!done.load(std::memory_order_relaxed)) {
waker.Wakeup();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
});
}
for (int i = 0; i < 30; i++) {
for (int i = 0; i < 5; i++) {
threads.emplace_back([&] {
while (!done.load(std::memory_order_relaxed)) {
waker.Set(Waker(new TestWakeable(&wakeups, &drops)));
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
});
}
for (int i = 0; i < 30; i++) {
for (int i = 0; i < 5; i++) {
threads.emplace_back([&] {
while (!done.load(std::memory_order_relaxed)) {
(waker.Armed() ? &armed : &not_armed)
->fetch_add(1, std::memory_order_relaxed);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
});
}

Loading…
Cancel
Save