diff --git a/src/core/lib/promise/party.cc b/src/core/lib/promise/party.cc index 5a14f235cf4..6d04e251ee8 100644 --- a/src/core/lib/promise/party.cc +++ b/src/core/lib/promise/party.cc @@ -178,6 +178,7 @@ Party::Participant::~Participant() { Party::~Party() {} void Party::CancelRemainingParticipants() { + if (!sync_.has_participants()) return; ScopedActivity activity(this); for (size_t i = 0; i < party_detail::kMaxParticipants; i++) { if (auto* p = diff --git a/src/core/lib/promise/party.h b/src/core/lib/promise/party.h index 6a1894ff2bf..b8f11cfd9bd 100644 --- a/src/core/lib/promise/party.h +++ b/src/core/lib/promise/party.h @@ -224,6 +224,10 @@ class PartySyncUsingAtomics { return iteration_.load(std::memory_order_relaxed); } + bool has_participants() const { + return (state_.load(std::memory_order_relaxed) & kAllocatedMask) != 0; + } + private: bool UnreffedLast();