mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::ctx: Block the caller after submit when parallel saturated.
This commit is contained in:
parent
d80a39097c
commit
4c5891e354
1 changed files with 6 additions and 4 deletions
|
@ -66,32 +66,34 @@ template<class arg>
|
|||
void
|
||||
ircd::ctx::parallel<arg>::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<class arg>
|
||||
void
|
||||
ircd::ctx::parallel<arg>::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<class arg>
|
||||
|
|
Loading…
Reference in a new issue