提交 a026f52b 编写于 作者: C chengduo 提交者: Yi Wang

refine channel (#7910)

上级 8a6a339e
...@@ -18,8 +18,7 @@ limitations under the License. */ ...@@ -18,8 +18,7 @@ limitations under the License. */
#include <queue> #include <queue>
namespace paddle { namespace paddle {
namespace operators { namespace framework {
namespace detail {
template <typename T> template <typename T>
class Channel { class Channel {
...@@ -38,7 +37,7 @@ class Channel { ...@@ -38,7 +37,7 @@ class Channel {
channel_.push_back(std::move(*channel_element)); channel_.push_back(std::move(*channel_element));
lock.unlock(); lock.unlock();
empty_cond_var_.notify_all(); empty_cond_var_.notify_one();
} }
T* Receive() { T* Receive() {
...@@ -75,7 +74,7 @@ class Channel { ...@@ -75,7 +74,7 @@ class Channel {
void NotifyAllSenders(std::unique_lock<std::mutex>* lock) { void NotifyAllSenders(std::unique_lock<std::mutex>* lock) {
if (IsBounded()) { if (IsBounded()) {
lock->unlock(); lock->unlock();
full_cond_var_.notify_all(); full_cond_var_.notify_one();
} }
} }
...@@ -84,6 +83,5 @@ class Channel { ...@@ -84,6 +83,5 @@ class Channel {
bool IsCapacityFull() const { return channel_.size() >= capacity_; } bool IsCapacityFull() const { return channel_.size() >= capacity_; }
}; };
} // namespace detail
} // namespace operator } // namespace operator
} // namespace paddle } // namespace paddle
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册