mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Another small change to MsgThread API.
Threads will now reliably get a call to DoFinish() no matter how the thread terminates. This will always be called from within the thread, whereas the destructor is called from the main thread after the child thread has already terminated. Also removing debugging code. However, two problems remain with the ASCII writer (seeing them only on MacOS): - the #start/#end timestamps contain only dummy values right now. The odd thing is that once I enable strftime() to print actual timestamps, I get crashes (even though strftime() is supposed to be thread-safe). - occassionally, there's still output missing in tests. In those cases, the file descriptor apparently goes bad: a write() will suddently return EBADF for reasons I don't understand yet.
This commit is contained in:
parent
053b307e24
commit
71fc2a1728
6 changed files with 39 additions and 27 deletions
|
@ -155,8 +155,6 @@ void MsgThread::OnPrepareStop()
|
|||
if ( finished || Killed() )
|
||||
return;
|
||||
|
||||
// XX fprintf(stderr, "Sending FINISH to thread %s ...\n", Name());
|
||||
|
||||
// Signal thread to terminate and wait until it has acknowledged.
|
||||
SendIn(new FinishMessage(this, network_time), true);
|
||||
}
|
||||
|
@ -356,7 +354,14 @@ void MsgThread::Run()
|
|||
delete msg;
|
||||
}
|
||||
|
||||
Finished();
|
||||
// In case we haven't send the finish method yet, do it now. Reading
|
||||
// global network_time here should be fine, it isn't changing
|
||||
// anymore.
|
||||
if ( ! finished )
|
||||
{
|
||||
OnFinish(network_time);
|
||||
Finished();
|
||||
}
|
||||
}
|
||||
|
||||
void MsgThread::GetStats(Stats* stats)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue