未验证 提交 62c1133f 编写于 作者: Y yuyang18

Add mutex for decorated_chain

上级 c48c586a
...@@ -21,6 +21,7 @@ ReaderBase::~ReaderBase() {} ...@@ -21,6 +21,7 @@ ReaderBase::~ReaderBase() {}
void ReaderBase::InsertDecoratedReader( void ReaderBase::InsertDecoratedReader(
const std::shared_ptr<ReaderBase> &decorated_reader) { const std::shared_ptr<ReaderBase> &decorated_reader) {
std::lock_guard<std::mutex> guard(decorated_readers_mtx_);
decorated_readers_.emplace_back(decorated_reader); decorated_readers_.emplace_back(decorated_reader);
} }
......
...@@ -45,6 +45,7 @@ class ReaderBase { ...@@ -45,6 +45,7 @@ class ReaderBase {
const std::shared_ptr<ReaderBase>& decorated_reader); const std::shared_ptr<ReaderBase>& decorated_reader);
// A set of which readers that decorated this reader. // A set of which readers that decorated this reader.
std::vector<std::weak_ptr<ReaderBase>> decorated_readers_; std::vector<std::weak_ptr<ReaderBase>> decorated_readers_;
std::mutex decorated_readers_mtx_;
}; };
class DecoratedReader : public ReaderBase, class DecoratedReader : public ReaderBase,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册