diff --git a/paddle/framework/details/buffered_channel.h b/paddle/framework/details/buffered_channel.h index b093e1589293b030ef2bedb82504a8e86b3dc857..9c806461aa500c140060a7f3d1918e05efec0434 100644 --- a/paddle/framework/details/buffered_channel.h +++ b/paddle/framework/details/buffered_channel.h @@ -49,6 +49,7 @@ class Buffered : public paddle::framework::Channel { } void NotifyAllSenders(std::unique_lock*); + void NotifyAllParticipants(std::unique_lock*); }; template @@ -80,7 +81,7 @@ template void Buffered::Close() { std::unique_lock lock(mu_); closed_ = true; - NotifyAllSenders(&lock); + NotifyAllParticipants(&lock); } template @@ -88,7 +89,7 @@ Buffered::~Buffered() { std::unique_lock lock(mu_); closed_ = true; channel_.clear(); - NotifyAllSenders(&lock); + NotifyAllParticipants(&lock); } template @@ -97,6 +98,13 @@ void Buffered::NotifyAllSenders(std::unique_lock* lock) { full_cond_var_.notify_all(); } +template +void Buffered::NotifyAllParticipants(std::unique_lock* lock) { + lock->unlock(); + full_cond_var_.notify_all(); + empty_cond_var_.notify_all(); +} + } // namespace details } // namespace framework } // namespace paddle