0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::ctx: Minor cleanup.

This commit is contained in:
Jason Volk 2018-08-21 08:10:37 -07:00
parent 57ea362daa
commit 7fb2a825a1
2 changed files with 21 additions and 23 deletions

View file

@ -34,6 +34,25 @@ ircd::ctx::ctx::id_ctr
0
};
/// Spawn (internal)
void
ircd::ctx::spawn(ctx *const c,
context::function func)
{
const boost::coroutines::attributes attrs
{
c->stack.max,
boost::coroutines::stack_unwind
};
auto bound
{
std::bind(&ctx::operator(), c, ph::_1, std::move(func))
};
boost::asio::spawn(c->strand, std::move(bound), attrs);
}
// linkage for dtor
ircd::ctx::ctx::~ctx()
noexcept
@ -812,29 +831,6 @@ noexcept
// ctx/context.h
//
namespace ircd::ctx
{
static void spawn(ctx *const c, context::function func);
}
void
ircd::ctx::spawn(ctx *const c,
context::function func)
{
const boost::coroutines::attributes attrs
{
c->stack.max,
boost::coroutines::stack_unwind
};
auto bound
{
std::bind(&ctx::operator(), c, ph::_1, std::move(func))
};
boost::asio::spawn(c->strand, std::move(bound), attrs);
}
ircd::ctx::context::context(const char *const &name,
const size_t &stack_sz,
const flags &flags,

View file

@ -12,6 +12,8 @@ namespace ircd::ctx
{
struct stack;
struct profile;
void spawn(ctx *const c, context::function func);
}
/// Internal structure aggregating any stack related state for the ctx