diff options
Diffstat (limited to 'src/channel.hpp')
-rw-r--r-- | src/channel.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/channel.hpp b/src/channel.hpp index 8c69f19..8441750 100644 --- a/src/channel.hpp +++ b/src/channel.hpp @@ -50,7 +50,7 @@ #include <boost/circular_buffer.hpp> template<typename T> -class channel +class Channel { private: boost::mutex mtx_; @@ -61,24 +61,24 @@ private: boost::lock_guard<boost::mutex> guard(mtx_); cb_.push_back(t); } - void pop_cb(T & ret) { + void pop_cb(T * ret) { boost::lock_guard<boost::mutex> guard(mtx_); - ret = cb_[0]; + *ret = cb_[0]; cb_.pop_front(); } public: - channel(channel const &) = delete; -// channel(channel &&) = delete; - channel& operator=(const channel &) = delete; - channel(unsigned int num_elements=10) + Channel(Channel const &) = delete; +// Channel(Channel &&) = delete; + Channel& operator=(const Channel &) = delete; + Channel(unsigned int num_elements=10) :cb_(num_elements),sem_read_(0),sem_write_(num_elements) {}; void push(T const & t ) { sem_write_.down(); this->push_cb(t); sem_read_.up(); } - void pop(T & ret) { + void pop(T * ret) { sem_read_.down(); this->pop_cb(ret); sem_write_.up(); |