blocking_queue.hpp
#ifndef CAFFE_UTIL_BLOCKING_QUEUE_HPP_
#define CAFFE_UTIL_BLOCKING_QUEUE_HPP_
#include <queue>
#include <string>
namespace caffe {
template<typename T>
class BlockingQueue {
public:
explicit BlockingQueue();
void push(const T& t);
bool try_pop(T* t);
// This logs a message if the threads needs to be blocked
// useful for detecting e.g. when data feeding is too slow
T pop(const string& log_on_wait = "");
bool try_peek(T* t);
// Return element without removing it
T peek();
size_t size() const;
protected:
class sync;
std::queue<T> queue_;
shared_ptr<sync> sync_;
DISABLE_COPY_AND_ASSIGN(BlockingQueue);
};
} // namespace caffe
#endif
caffe::BlockingQueue
Definition: blocking_queue.hpp:10
caffe::BlockingQueue::sync
Definition: blocking_queue.cpp:11
caffe
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14