From 9cd05a9b74ee5b18fc12c5ee1cb5192337db6590 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Thu, 31 Jul 2014 10:54:03 +0000 Subject: added one new thread. memory pool still needs work. some kind of auto pointer returning memory would be nice. crypto needs bigger refactoring i'm afraid --- src/channel.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/channel.hpp') 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 template -class channel +class Channel { private: boost::mutex mtx_; @@ -61,24 +61,24 @@ private: boost::lock_guard guard(mtx_); cb_.push_back(t); } - void pop_cb(T & ret) { + void pop_cb(T * ret) { boost::lock_guard 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(); -- cgit v1.2.3