Caffe
blocking_queue.hpp
1 #ifndef CAFFE_UTIL_BLOCKING_QUEUE_HPP_
2 #define CAFFE_UTIL_BLOCKING_QUEUE_HPP_
3 
4 #include <queue>
5 #include <string>
6 
7 namespace caffe {
8 
9 template<typename T>
11  public:
12  explicit BlockingQueue();
13 
14  void push(const T& t);
15 
16  bool try_pop(T* t);
17 
18  // This logs a message if the threads needs to be blocked
19  // useful for detecting e.g. when data feeding is too slow
20  T pop(const string& log_on_wait = "");
21 
22  bool try_peek(T* t);
23 
24  // Return element without removing it
25  T peek();
26 
27  size_t size() const;
28 
29  protected:
35  class sync;
36 
37  std::queue<T> queue_;
38  shared_ptr<sync> sync_;
39 
40 DISABLE_COPY_AND_ASSIGN(BlockingQueue);
41 };
42 
43 } // namespace caffe
44 
45 #endif
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
Definition: blocking_queue.cpp:11
Definition: blocking_queue.hpp:10