mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Improved signal handling.
Sending SIGTERM triggers a normal shutdown of all threads that waits until they have processed their remaining data. However, sending a 2nd SIGTERM while waiting for them to finish will immediately kill them all.
This commit is contained in:
parent
ffb4094d36
commit
4879cb7b0d
5 changed files with 56 additions and 0 deletions
|
@ -9,6 +9,7 @@ Manager::Manager()
|
|||
|
||||
did_process = false;
|
||||
next_beat = 0;
|
||||
terminating = false;
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
|
@ -21,6 +22,8 @@ void Manager::Terminate()
|
|||
{
|
||||
DBG_LOG(DBG_THREADING, "Terminating thread manager ...");
|
||||
|
||||
terminating = true;
|
||||
|
||||
// First process remaining thread output for the message threads.
|
||||
do Process(); while ( did_process );
|
||||
|
||||
|
@ -37,6 +40,16 @@ void Manager::Terminate()
|
|||
|
||||
all_threads.clear();
|
||||
msg_threads.clear();
|
||||
|
||||
terminating = false;
|
||||
}
|
||||
|
||||
void Manager::KillThreads()
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "Killing threads ...");
|
||||
|
||||
for ( all_thread_list::iterator i = all_threads.begin(); i != all_threads.end(); i++ )
|
||||
(*i)->Kill();
|
||||
}
|
||||
|
||||
void Manager::AddThread(BasicThread* thread)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue