From b796668a779c539ffe5a6df98d5475553c1cf147 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 19 Aug 2018 16:21:33 -0700 Subject: [PATCH] ircd::ctx: Minor movement/cleanup. --- ircd/ctx.cc | 22 ++++++++++++++++++++-- ircd/ctx.h | 4 ++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ircd/ctx.cc b/ircd/ctx.cc index 0cf888bde..c5db4a794 100644 --- a/ircd/ctx.cc +++ b/ircd/ctx.cc @@ -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); } diff --git a/ircd/ctx.h b/ircd/ctx.h index 46bd3e582..207cd0cd3 100644 --- a/ircd/ctx.h +++ b/ircd/ctx.h @@ -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