mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd::ctx: Belay marking entry point until after initial interrupt check.
This commit is contained in:
parent
bfe864663c
commit
d1c2e0baeb
1 changed files with 11 additions and 2 deletions
13
ircd/ctx.cc
13
ircd/ctx.cc
|
@ -150,10 +150,8 @@ noexcept try
|
|||
this->yc = &yc;
|
||||
notes = 1;
|
||||
stack.base = uintptr_t(__builtin_frame_address(0));
|
||||
mark(prof::event::ENTER);
|
||||
const unwind atexit{[this]
|
||||
{
|
||||
mark(prof::event::LEAVE);
|
||||
adjoindre.notify_all();
|
||||
stack.at = 0;
|
||||
notes = 0;
|
||||
|
@ -166,6 +164,17 @@ noexcept try
|
|||
// Check for a precocious interrupt
|
||||
interruption_point();
|
||||
|
||||
// Mark the point of context entry only after the interrupt check. If the
|
||||
// context was interrupted without ever entering (which makes the above
|
||||
// check throw) we never record any execution slice or increment the epoch
|
||||
// counter for it. This can allow a parent context to assume application
|
||||
// state remains unmodified by the aborted context.
|
||||
mark(prof::event::ENTER);
|
||||
const unwind leaver{[this]
|
||||
{
|
||||
mark(prof::event::LEAVE);
|
||||
}};
|
||||
|
||||
// Call the user's function.
|
||||
func();
|
||||
|
||||
|
|
Loading…
Reference in a new issue