diff --git a/src/internal.hpp b/src/internal.hpp index f0fd783..650a50f 100644 --- a/src/internal.hpp +++ b/src/internal.hpp @@ -55,22 +55,25 @@ namespace sigfn template void handle_sigset(IteratorType begin, IteratorType end, channels::buffered_channel &channel) { - if (std::distance(begin, end) == 0) + if (std::distance(begin, end) > 0) + { + std::for_each( + begin, + end, + [&](int signum) + { + sigfn::handle( + signum, + [&](int value) + { + channel.write(value); + }); + }); + } + else { throw std::runtime_error(empty_sigset); } - std::for_each( - begin, - end, - [&](int signum) - { - sigfn::handle( - signum, - [&](int value) - { - channel.write(value); - }); - }); } template