mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +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
|
@ -43,6 +43,21 @@ public:
|
|||
*/
|
||||
void Terminate();
|
||||
|
||||
/**
|
||||
* Returns True if we are currently in Terminate() waiting for
|
||||
* threads to exit.
|
||||
*/
|
||||
bool Terminating() const { return terminating; }
|
||||
|
||||
/**
|
||||
* Immediately kills all child threads. It does however not yet join
|
||||
* them, one still needs to call Terminate() for that.
|
||||
*
|
||||
* This method is safe to call from a signal handler, and can in fact
|
||||
* be called while Terminate() is already in progress.
|
||||
*/
|
||||
void KillThreads();
|
||||
|
||||
typedef std::list<std::pair<string, MsgThread::Stats> > msg_stats_list;
|
||||
|
||||
/**
|
||||
|
@ -115,6 +130,7 @@ private:
|
|||
|
||||
bool did_process; // True if the last Process() found some work to do.
|
||||
double next_beat; // Timestamp when the next heartbeat will be sent.
|
||||
bool terminating; // True if we are in Terminate().
|
||||
|
||||
msg_stats_list stats;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue