mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 15:04:10 +01:00
ircd::ios: Consolidate notification interface for now; add atexit related.
This commit is contained in:
parent
c664963e8d
commit
29b0523dfc
6 changed files with 80 additions and 43 deletions
|
@ -250,7 +250,7 @@ void
|
|||
construct::handle_cont()
|
||||
try
|
||||
{
|
||||
ircd::cont();
|
||||
ircd::ios::continuing();
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
|
|
|
@ -34,9 +34,12 @@ namespace ircd::ios
|
|||
bool available() noexcept;
|
||||
const uint64_t &epoch() noexcept;
|
||||
|
||||
void forked_parent();
|
||||
void forked_child();
|
||||
void forking();
|
||||
void forking(); // fork prepare
|
||||
void forked_child(); // on fork child
|
||||
void forked_parent(); // on fork parent
|
||||
void continuing() noexcept; // on SIGCONT
|
||||
void exiting() noexcept; // on atexit
|
||||
void exiting_quick() noexcept; // on at_quick_exit
|
||||
|
||||
void init(asio::executor &&);
|
||||
}
|
||||
|
|
|
@ -154,7 +154,6 @@ namespace ircd
|
|||
seconds uptime();
|
||||
|
||||
// Control panel
|
||||
void cont() noexcept;
|
||||
bool quit() noexcept;
|
||||
void init(boost::asio::executor &&, user_main);
|
||||
}
|
||||
|
|
74
ircd/ios.cc
74
ircd/ios.cc
|
@ -79,7 +79,75 @@ ircd::ios::init(asio::executor &&user)
|
|||
ios::main = *ios::primary;
|
||||
}
|
||||
|
||||
[[using gnu: cold, visibility("hidden")]]
|
||||
[[using gnu: cold]]
|
||||
void
|
||||
ircd::ios::exiting_quick()
|
||||
noexcept
|
||||
{
|
||||
if(run::level == run::level::HALT)
|
||||
return;
|
||||
|
||||
if(ircd::debugmode)
|
||||
log::logf
|
||||
{
|
||||
log::star, log::level::DEBUG,
|
||||
"IRCd notified of quick exit() in runlevel:%s ctx:%p",
|
||||
reflect(run::level),
|
||||
(const void *)ctx::current,
|
||||
};
|
||||
}
|
||||
|
||||
[[using gnu: cold]]
|
||||
void
|
||||
ircd::ios::exiting()
|
||||
noexcept
|
||||
{
|
||||
if(run::level == run::level::HALT)
|
||||
return;
|
||||
|
||||
if(ircd::debugmode)
|
||||
log::logf
|
||||
{
|
||||
log::star, log::level::DEBUG,
|
||||
"IRCd notified of exit() in runlevel:%s ctx:%p",
|
||||
reflect(run::level),
|
||||
(const void *)ctx::current,
|
||||
};
|
||||
}
|
||||
|
||||
[[using gnu: cold]]
|
||||
void
|
||||
ircd::ios::continuing()
|
||||
noexcept
|
||||
{
|
||||
if(run::level == run::level::HALT)
|
||||
return;
|
||||
|
||||
log::logf
|
||||
{
|
||||
log::star, log::level::DEBUG,
|
||||
"IRCd notified of SIGCONT in runlevel:%s ctx:%p",
|
||||
reflect(run::level),
|
||||
(const void *)ctx::current,
|
||||
};
|
||||
|
||||
switch(run::level)
|
||||
{
|
||||
case run::level::RUN:
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
log::notice
|
||||
{
|
||||
log::star, "IRCd resuming service in runlevel %s.",
|
||||
reflect(run::level),
|
||||
};
|
||||
}
|
||||
|
||||
[[using gnu: cold]]
|
||||
void
|
||||
ircd::ios::forking()
|
||||
{
|
||||
|
@ -90,7 +158,7 @@ ircd::ios::forking()
|
|||
#endif
|
||||
}
|
||||
|
||||
[[using gnu: cold, visibility("hidden")]]
|
||||
[[using gnu: cold]]
|
||||
void
|
||||
ircd::ios::forked_child()
|
||||
{
|
||||
|
@ -101,7 +169,7 @@ ircd::ios::forked_child()
|
|||
#endif
|
||||
}
|
||||
|
||||
[[using gnu: cold, visibility("hidden")]]
|
||||
[[using gnu: cold]]
|
||||
void
|
||||
ircd::ios::forked_parent()
|
||||
{
|
||||
|
|
33
ircd/ircd.cc
33
ircd/ircd.cc
|
@ -293,39 +293,6 @@ noexcept
|
|||
return false;
|
||||
}
|
||||
|
||||
/// Notifies IRCd that execution is being resumed after a significant gap.
|
||||
/// Basically this is connected to a SIGCONT handler and beneficial after
|
||||
/// user stops, debugging and ACPI suspensions, etc. It is not required at
|
||||
/// this time, but its connection is advised for best behavior.
|
||||
void
|
||||
ircd::cont()
|
||||
noexcept
|
||||
{
|
||||
log::logf
|
||||
{
|
||||
log::star, log::level::DEBUG,
|
||||
"IRCd cont requested from runlevel:%s ctx:%p main_context:%p",
|
||||
reflect(run::level),
|
||||
(const void *)ctx::current,
|
||||
(const void *)main_context
|
||||
};
|
||||
|
||||
switch(run::level)
|
||||
{
|
||||
case run::level::RUN:
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
log::notice
|
||||
{
|
||||
log::star, "IRCd resuming service in runlevel %s.",
|
||||
reflect(run::level),
|
||||
};
|
||||
}
|
||||
|
||||
/// Main context; Main program. Do not call this function directly.
|
||||
///
|
||||
/// This function manages the lifetime for all resources and subsystems
|
||||
|
|
|
@ -2796,7 +2796,7 @@ console_cmd__ctx__interrupt(opt &out, const string_view &line)
|
|||
}};
|
||||
|
||||
size_t count(0);
|
||||
for(size_t i(0); i < param.count() && cont; ++i)
|
||||
for(size_t i(0); i < param.count(); ++i)
|
||||
count += !ctx::for_each([&](auto &ctx)
|
||||
{
|
||||
if(id(ctx) == param.at<uint64_t>(i))
|
||||
|
@ -2866,7 +2866,7 @@ console_cmd__ctx__term(opt &out, const string_view &line)
|
|||
}};
|
||||
|
||||
size_t count(0);
|
||||
for(size_t i(0); i < param.count() && cont; ++i)
|
||||
for(size_t i(0); i < param.count(); ++i)
|
||||
count += !ctx::for_each([&](auto &ctx)
|
||||
{
|
||||
if(id(ctx) == param.at<uint64_t>(i))
|
||||
|
|
Loading…
Reference in a new issue