mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Prevent duplicate "finish" threading messages
As they don't get processed and may show up as a memory leak.
This commit is contained in:
parent
3742e5601c
commit
9e07b8a9f1
2 changed files with 4 additions and 1 deletions
|
@ -176,6 +176,7 @@ MsgThread::MsgThread() : BasicThread(), queue_in(this, 0), queue_out(0, this)
|
||||||
cnt_sent_in = cnt_sent_out = 0;
|
cnt_sent_in = cnt_sent_out = 0;
|
||||||
main_finished = false;
|
main_finished = false;
|
||||||
child_finished = false;
|
child_finished = false;
|
||||||
|
child_sent_finish = false;
|
||||||
failed = false;
|
failed = false;
|
||||||
thread_mgr->AddMsgThread(this);
|
thread_mgr->AddMsgThread(this);
|
||||||
}
|
}
|
||||||
|
@ -185,9 +186,10 @@ extern int signal_val;
|
||||||
|
|
||||||
void MsgThread::OnSignalStop()
|
void MsgThread::OnSignalStop()
|
||||||
{
|
{
|
||||||
if ( main_finished || Killed() )
|
if ( main_finished || Killed() || child_sent_finish )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
child_sent_finish = true;
|
||||||
// Signal thread to terminate.
|
// Signal thread to terminate.
|
||||||
SendIn(new FinishMessage(this, network_time), true);
|
SendIn(new FinishMessage(this, network_time), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,6 +306,7 @@ private:
|
||||||
|
|
||||||
bool main_finished; // Main thread is finished, meaning child_finished propagated back through message queue.
|
bool main_finished; // Main thread is finished, meaning child_finished propagated back through message queue.
|
||||||
bool child_finished; // Child thread is finished.
|
bool child_finished; // Child thread is finished.
|
||||||
|
bool child_sent_finish; // Child thread asked to be finished.
|
||||||
bool failed; // Set to true when a command failed.
|
bool failed; // Set to true when a command failed.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue