From 6eaab69a767723c63faa5ca5d1560e58dce80b49 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Wed, 29 Jul 2015 20:06:06 +0200 Subject: [PATCH] bounded-channel: high-watermark must be greater than zero --- include/boost/fiber/bounded_channel.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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;