| 8 | |
| 9 | template<typename T> |
| 10 | class BlockingQueue { |
| 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: |
| 30 | /** |
| 31 | Move synchronization fields out instead of including boost/thread.hpp |
| 32 | to avoid a boost/NVCC issues (#1009, #1010) on OSX. Also fails on |
| 33 | Linux CUDA 7.0.18. |
| 34 | */ |
| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected