0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd::ctx: Minor movement/cleanup.

This commit is contained in:
Jason Volk 2018-08-19 16:21:33 -07:00
parent f4a4674daa
commit b796668a77
2 changed files with 22 additions and 4 deletions

View file

@ -246,6 +246,20 @@ ircd::ctx::ctx::interruption_point(std::nothrow_t)
else return false;
}
bool
ircd::ctx::ctx::started()
const
{
return stack.base != 0;
}
bool
ircd::ctx::ctx::finished()
const
{
return started() && yc == nullptr;
}
///////////////////////////////////////////////////////////////////////////////
//
// ctx/ctx.h
@ -923,9 +937,13 @@ ircd::ctx::context::join()
if(joined())
return;
mark(prof::event::JOIN);
assert(bool(c));
c->adjoindre.wait();
mark(prof::event::JOIN);
c->adjoindre.wait([this]
{
return joined();
});
mark(prof::event::JOINED);
}

View file

@ -55,8 +55,8 @@ struct ircd::ctx::ctx
list::node node; // node for ctx::list
dock adjoindre; // contexts waiting for this to join()
bool started() const { return stack.base != 0; }
bool finished() const { return started() && yc == nullptr; }
bool started() const; // context was ever entered
bool finished() const; // context will not be further entered.
bool interruption_point(std::nothrow_t); // Check for interrupt (and clear flag)
bool termination_point(std::nothrow_t); // Check for terminate