summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2014-07-31 13:09:52 +0000
committerOthmar Gsenger <otti@anytun.org>2014-07-31 13:09:52 +0000
commitd5baa3b1a5d3817753f48206ce2ad830e6311eb3 (patch)
tree5353053b921dd1becde648db8edef7deb1b150ed
parentadded one new thread. memory pool still needs work. some kind of auto pointer... (diff)
fix compiler warning
-rw-r--r--src/channel.hpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/channel.hpp b/src/channel.hpp
index 8441750..c30dd61 100644
--- a/src/channel.hpp
+++ b/src/channel.hpp
@@ -48,11 +48,23 @@
#include <boost/thread/thread.hpp>
#include <boost/circular_buffer.hpp>
+#include <boost/assert.hpp>
+#ifdef BOOST_NO_CXX11_DELETED_FUNCTIONS
+#include <boost/noncopyable.hpp>
+#endif
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
template<typename T>
class Channel
+#ifdef BOOST_NO_CXX11_DELETED_FUNCTIONS
+ : boost::noncopyable
+#endif
{
private:
+#ifdef BOOST_HAS_TRIVIAL_ASSIGN
+ BOOST_STATIC_ASSERT((boost::has_trivial_assign<T>::value));
+#endif
boost::mutex mtx_;
boost::circular_buffer<T> cb_;
Semaphore sem_read_, sem_write_;
@@ -68,9 +80,11 @@ private:
}
public:
+#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
Channel(Channel const &) = delete;
-// Channel(Channel &&) = delete;
+ Channel(Channel &&) = delete;
Channel& operator=(const Channel &) = delete;
+#endif
Channel(unsigned int num_elements=10)
:cb_(num_elements),sem_read_(0),sem_write_(num_elements) {};
void push(T const & t ) {