mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +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
|
@ -197,10 +197,6 @@ protected:
|
|||
*/
|
||||
virtual void Heartbeat();
|
||||
|
||||
/** Flags that the child process has finished processing. Called from child.
|
||||
*/
|
||||
void Finished();
|
||||
|
||||
/** Internal heartbeat processing. Called from child.
|
||||
*/
|
||||
void HeartbeatInChild();
|
||||
|
@ -217,8 +213,7 @@ protected:
|
|||
virtual bool OnHeartbeat(double network_time, double current_time) = 0;
|
||||
|
||||
/** Triggered for execution in the child thread just before shutting threads down.
|
||||
* The child thread should finish its operations and then *must*
|
||||
* call this class' implementation.
|
||||
* The child thread should finish its operations.
|
||||
*/
|
||||
virtual bool OnFinish(double network_time) = 0;
|
||||
|
||||
|
@ -288,6 +283,10 @@ private:
|
|||
*/
|
||||
bool MightHaveOut() { return queue_out.MaybeReady(); }
|
||||
|
||||
/** Flags that the child process has finished processing. Called from child.
|
||||
*/
|
||||
void Finished();
|
||||
|
||||
Queue<BasicInputMessage *> queue_in;
|
||||
Queue<BasicOutputMessage *> queue_out;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue