mirror of
https://github.com/matrix-construct/construct
synced 2024-12-01 19:22:53 +01:00
ircd::ctx: Consistent use of interruption.
This commit is contained in:
parent
38c5679b5a
commit
10434c96c5
1 changed files with 3 additions and 9 deletions
12
ircd/ctx.cc
12
ircd/ctx.cc
|
@ -925,7 +925,7 @@ noexcept
|
||||||
// Can't join to bare metal, only from within another context.
|
// Can't join to bare metal, only from within another context.
|
||||||
if(current)
|
if(current)
|
||||||
{
|
{
|
||||||
terminate();
|
interrupt();
|
||||||
join();
|
join();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -993,7 +993,7 @@ ircd::ctx::pool::pool(const char *const &name,
|
||||||
ircd::ctx::pool::~pool()
|
ircd::ctx::pool::~pool()
|
||||||
noexcept
|
noexcept
|
||||||
{
|
{
|
||||||
terminate();
|
interrupt();
|
||||||
join();
|
join();
|
||||||
assert(ctxs.empty());
|
assert(ctxs.empty());
|
||||||
assert(queue.empty());
|
assert(queue.empty());
|
||||||
|
@ -1021,10 +1021,7 @@ ircd::ctx::pool::del(const size_t &num)
|
||||||
|
|
||||||
const uninterruptible ui;
|
const uninterruptible ui;
|
||||||
while(ctxs.size() > target)
|
while(ctxs.size() > target)
|
||||||
{
|
|
||||||
ctxs.back().terminate();
|
|
||||||
ctxs.pop_back();
|
ctxs.pop_back();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1037,10 +1034,7 @@ ircd::ctx::pool::add(const size_t &num)
|
||||||
void
|
void
|
||||||
ircd::ctx::pool::join()
|
ircd::ctx::pool::join()
|
||||||
{
|
{
|
||||||
for(auto &context : ctxs)
|
del(size());
|
||||||
context.join();
|
|
||||||
|
|
||||||
ctxs.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue