0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd::ctx: Add context::WAIT_JOIN feature flag.

This commit is contained in:
Jason Volk 2019-03-26 14:49:43 -07:00
parent 08479976ad
commit 6fbd29b1ed
2 changed files with 7 additions and 1 deletions

View file

@ -104,6 +104,7 @@ enum ircd::ctx::context::flags
NOINTERRUPT = 0x0008, ///< Interruption points won't throw while lit.
SLICE_EXEMPT = 0x0010, ///< The watchdog will ignore excessive cpu usage.
STACK_EXEMPT = 0x0020, ///< The watchdog will ignore excessive stack usage.
WAIT_JOIN = 0x0040, ///< Destruction of instance won't terminate ctx.
INTERRUPTED = 0x4000, ///< (INDICATOR) Marked
TERMINATED = 0x8000, ///< (INDICATOR)

View file

@ -1221,7 +1221,12 @@ noexcept
if(current)
{
const uninterruptible::nothrow ui;
terminate();
// When the WAIT_JOIN flag is given we wait for the context to
// complete cooperatively before this destructs.
if(~c->flags & context::WAIT_JOIN)
terminate();
join();
return;
}