diff --git a/include/boost/fiber/bounded_channel.hpp b/include/boost/fiber/bounded_channel.hpp index e11d6d7e..661d7703 100644 --- a/include/boost/fiber/bounded_channel.hpp +++ b/include/boost/fiber/bounded_channel.hpp @@ -217,6 +217,10 @@ public: throw invalid_argument( static_cast< int >( std::errc::invalid_argument), "boost fiber: high-watermark is less than low-watermark for bounded_channel"); } + if ( 0 == hwm) { + throw invalid_argument( static_cast< int >( std::errc::invalid_argument), + "boost fiber: high-watermark is zero"); + } } bounded_channel( std::size_t wm, @@ -231,6 +235,10 @@ public: not_full_cond_(), hwm_( wm), lwm_( wm) { + if ( 0 == wm) { + throw invalid_argument( static_cast< int >( std::errc::invalid_argument), + "boost fiber: watermark is zero"); + } } bounded_channel( bounded_channel const&) = delete;