From ee7d8b4d666822fc82440d837c79603ce0cdc5c1 Mon Sep 17 00:00:00 2001 From: yuyang18 Date: Fri, 13 Jul 2018 17:12:01 +0800 Subject: [PATCH] Refine Shutdown Impl --- .../fluid/operators/reader/create_double_buffer_reader_op.cc | 4 +--- paddle/fluid/operators/reader/create_shuffle_reader_op.cc | 2 +- paddle/fluid/operators/reader/open_files_op.cc | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc index 7b14370f4fd..f3c0deb19fe 100644 --- a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc +++ b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc @@ -52,12 +52,10 @@ class DoubleBufferReader : public framework::DecoratedReader { void ReadNextImpl(std::vector* out) override; - ~DoubleBufferReader() { EndPrefetcher(); } - private: void ShutdownImpl() override { - EndPrefetcher(); reader_->Shutdown(); + EndPrefetcher(); } void StartImpl() override { diff --git a/paddle/fluid/operators/reader/create_shuffle_reader_op.cc b/paddle/fluid/operators/reader/create_shuffle_reader_op.cc index 4b308abc290..3f72890a7ce 100644 --- a/paddle/fluid/operators/reader/create_shuffle_reader_op.cc +++ b/paddle/fluid/operators/reader/create_shuffle_reader_op.cc @@ -48,9 +48,9 @@ class ShuffleReader : public framework::DecoratedReader { private: void ShutdownImpl() override { + reader_->Shutdown(); buffer_.clear(); iteration_pos_ = 0; - reader_->Shutdown(); } void StartImpl() override { diff --git a/paddle/fluid/operators/reader/open_files_op.cc b/paddle/fluid/operators/reader/open_files_op.cc index 9a8d203672f..51a00c0007e 100644 --- a/paddle/fluid/operators/reader/open_files_op.cc +++ b/paddle/fluid/operators/reader/open_files_op.cc @@ -36,8 +36,6 @@ class MultiFileReader : public framework::ReaderBase { void ReadNextImpl(std::vector* out) override; - ~MultiFileReader() { EndScheduler(); } - private: void ShutdownImpl() override { EndScheduler(); } -- GitLab