mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd:Ⓜ️:vm: Checkpoint phase-as-class skeleton.
This commit is contained in:
parent
cc0072df0e
commit
912562f469
3 changed files with 22 additions and 3 deletions
|
@ -247,8 +247,11 @@ struct ircd::m::vm::phase
|
|||
:instance_list<phase>
|
||||
{
|
||||
string_view name;
|
||||
std::function<void (eval &)> function;
|
||||
|
||||
phase(const string_view &name);
|
||||
void operator()(eval &);
|
||||
|
||||
phase(const string_view &name, decltype(function) = nullptr);
|
||||
};
|
||||
|
||||
struct ircd::m::vm::accepted
|
||||
|
|
19
ircd/m/m.cc
19
ircd/m/m.cc
|
@ -616,12 +616,27 @@ decltype(ircd::util::instance_list<ircd::m::vm::phase>::list)
|
|||
ircd::util::instance_list<ircd::m::vm::phase>::list
|
||||
{};
|
||||
|
||||
|
||||
ircd::m::vm::phase::phase(const string_view &name)
|
||||
ircd::m::vm::phase::phase(const string_view &name,
|
||||
decltype(function) function)
|
||||
:name{name}
|
||||
,function{std::move(function)}
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ircd::m::vm::phase::operator()(eval &eval)
|
||||
{
|
||||
auto theirs(eval.phase);
|
||||
eval.phase = this;
|
||||
const unwind _{[&eval, &theirs]
|
||||
{
|
||||
eval.phase = theirs;
|
||||
}};
|
||||
|
||||
if(likely(function))
|
||||
function(eval);
|
||||
}
|
||||
|
||||
//
|
||||
// accepted
|
||||
//
|
||||
|
|
|
@ -7395,6 +7395,7 @@ console_cmd__vm__eval(opt &out, const string_view &line)
|
|||
out << std::setw(9) << std::right << eval->id
|
||||
<< " | " << std::setw(4) << std::right << id(*eval->ctx)
|
||||
<< " | " << std::setw(4) << std::right << eval->sequence
|
||||
<< " | " << std::setw(16) << std::left << (eval->phase? eval->phase->name : "")
|
||||
<< " | " << std::setw(64) << std::left << eval->event_id
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue