| 16 | static boost::mutex bodies_mutex_; |
| 17 | |
| 18 | DataReader::DataReader(const LayerParameter& param) |
| 19 | : queue_pair_(new QueuePair( // |
| 20 | param.data_param().prefetch() * param.data_param().batch_size())) { |
| 21 | // Get or create a body |
| 22 | boost::mutex::scoped_lock lock(bodies_mutex_); |
| 23 | string key = source_key(param); |
| 24 | weak_ptr<Body>& weak = bodies_[key]; |
| 25 | body_ = weak.lock(); |
| 26 | if (!body_) { |
| 27 | body_.reset(new Body(param)); |
| 28 | bodies_[key] = weak_ptr<Body>(body_); |
| 29 | } |
| 30 | body_->new_queue_pairs_.push(queue_pair_); |
| 31 | } |
| 32 | |
| 33 | DataReader::~DataReader() { |
| 34 | string key = source_key(body_->param_); |
nothing calls this directly
no test coverage detected