0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd::ios: Track current handler like ctx::current.

This commit is contained in:
Jason Volk 2019-03-27 02:06:55 -07:00
parent 1e900217ee
commit 02f413c834
2 changed files with 9 additions and 0 deletions

View file

@ -89,6 +89,8 @@ struct ircd::ios::descriptor
struct ircd::ios::handler
{
static thread_local handler *current;
static void *allocate(handler *const &, const size_t &);
static void deallocate(handler *const &, void *const &, const size_t &);
static void enter(handler *const &);

View file

@ -138,6 +138,9 @@ noexcept
// handler
//
decltype(ircd::ios::handler::current) thread_local
ircd::ios::handler::current;
bool
ircd::ios::handler::fault(handler *const &handler)
{
@ -164,6 +167,8 @@ ircd::ios::handler::leave(handler *const &handler)
auto &descriptor(*handler->descriptor);
descriptor.slice_last = cycles() - handler->slice_start;
descriptor.slice_total += descriptor.slice_last;
assert(handler::current == handler);
handler::current = nullptr;
}
void
@ -172,6 +177,8 @@ ircd::ios::handler::enter(handler *const &handler)
assert(handler && handler->descriptor);
auto &descriptor(*handler->descriptor);
++descriptor.calls;
assert(!handler::current);
handler::current = handler;
handler->slice_start = cycles();
}