1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 14:06:38 +02:00

Moved signal/thread/mode checking to use signal pipes

This commit is contained in:
Adam
2011-09-05 18:44:43 -04:00
parent dc5d1fa21c
commit 63cb8ca24c
12 changed files with 101 additions and 152 deletions
+2 -24
View File
@@ -207,21 +207,10 @@ void Signal::SignalHandler(int signal)
{
for (unsigned i = 0, j = SignalHandlers.size(); i < j; ++i)
if (SignalHandlers[i]->signal == signal)
SignalHandlers[i]->called = true;
SignalHandlers[i]->Notify();
}
void Signal::Process()
{
for (unsigned i = 0, j = SignalHandlers.size(); i < j; ++i)
if (SignalHandlers[i]->called == true)
{
Signal *s = SignalHandlers[i];
s->called = false;
s->OnSignal();
}
}
Signal::Signal(int s) : called(false), signal(s)
Signal::Signal(int s) : Pipe(), signal(s)
{
memset(&this->old, 0, sizeof(this->old));
@@ -244,7 +233,6 @@ Signal::~Signal()
sigaction(this->signal, &this->old, NULL);
}
/*************************************************************************/
/** The following comes from InspIRCd to get the full path of the Anope executable
@@ -355,9 +343,6 @@ int main(int ac, char **av, char **envp)
{
Log(LOG_DEBUG_2) << "Top of main loop";
/* Process signals */
Signal::Process();
/* Process timers */
if (Anope::CurTime - last_check >= Config->TimeoutCheck)
{
@@ -365,13 +350,6 @@ int main(int ac, char **av, char **envp)
last_check = Anope::CurTime;
}
/* Free up any finished threads */
threadEngine.Process();
/* Process any modes that need to be (un)set */
if (Me->IsSynced())
ModeManager::ProcessModes();
/* Process the socket engine */
SocketEngine::Process();
}