mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Change thread shutdown again to also work with input framework.
Seems to work, tests pass, but not really verified. Major change 1: finished flag in MsgThread was replaced by 2 flags: child_finished and main_finished. child_finished is set by child_thread and means that the processing loop is stopped immediately (no longer needed, no new input messages will be processed, if loop continues running there is an ugly delay on shutdown). (This took me a while to realize...) main_finished is set by a message that is sent back by the child to the main thread when Finished() is called (and child_finished is set). when main_finished is set, processing of output messages stops. But all messages that the child thread pushed in the queue before calling Finish() are still processed. Change 2: Logging terminate call was replaced by a smaller call that just flushes out the cache held by the main thread. This call has to be done before thread shutdown is called - otherwhise the threads will be shut down before all messages are pushed on them. (This also took me a while to realize...). Change 3: Input framework actually calls it stop methods correctly (everything was prepared, function call was missing)
This commit is contained in:
parent
bb1e2f57b9
commit
39f1b9e01f
12 changed files with 67 additions and 39 deletions
|
@ -289,7 +289,8 @@ private:
|
|||
*/
|
||||
bool MightHaveOut() { return queue_out.MaybeReady(); }
|
||||
|
||||
/** Flags that the child process has finished processing. Called from child.
|
||||
/** Sends a message to the main thread signaling that the child process
|
||||
* has finished processing. Called from child.
|
||||
*/
|
||||
void Finished();
|
||||
|
||||
|
@ -299,7 +300,8 @@ private:
|
|||
uint64_t cnt_sent_in; // Counts message sent to child.
|
||||
uint64_t cnt_sent_out; // Counts message sent by child.
|
||||
|
||||
bool finished; // Set to true by Finished message.
|
||||
bool main_finished; // main thread is finished. Means child_finished propagated back through message queue.
|
||||
bool child_finished; // child thread is finished
|
||||
bool failed; // Set to true when a command failed.
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue