From 4c5891e354c382c6095264883af6744086777d76 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 26 Dec 2018 17:35:49 -0800 Subject: [PATCH] ircd::ctx: Block the caller after submit when parallel saturated. --- include/ircd/ctx/parallel.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/ircd/ctx/parallel.h b/include/ircd/ctx/parallel.h index b12a7446c..1fc7cf7a2 100644 --- a/include/ircd/ctx/parallel.h +++ b/include/ircd/ctx/parallel.h @@ -66,32 +66,34 @@ template void ircd::ctx::parallel::operator()(const arg &a) { - wait_avail(); if(this->eptr) std::rethrow_exception(this->eptr); this->a.at(snd++) = a; snd %= this->a.size(); - out++; auto &p(*this->p); p(std::bind(¶llel::receiver, this)); + + out++; + wait_avail(); } template void ircd::ctx::parallel::operator()() { - wait_avail(); if(this->eptr) std::rethrow_exception(this->eptr); snd++; snd %= this->a.size(); - out++; auto &p(*this->p); p(std::bind(¶llel::receiver, this)); + + out++; + wait_avail(); } template