mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
cluster/ThreadedBackend: Invoke onloop->Process() during DoTerminate()
Also, document how to use ThreadedBackend's DoTerminate()
This commit is contained in:
parent
85a2694cb2
commit
eb2eaee284
2 changed files with 14 additions and 1 deletions
|
@ -203,6 +203,7 @@ bool ThreadedBackend::DoInit() {
|
||||||
|
|
||||||
void ThreadedBackend::DoTerminate() {
|
void ThreadedBackend::DoTerminate() {
|
||||||
if ( onloop ) {
|
if ( onloop ) {
|
||||||
|
onloop->Process();
|
||||||
onloop->Close();
|
onloop->Close();
|
||||||
onloop = nullptr;
|
onloop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,7 +564,8 @@ protected:
|
||||||
/**
|
/**
|
||||||
* To be used by implementations to enqueue messages for processing on the IO loop.
|
* To be used by implementations to enqueue messages for processing on the IO loop.
|
||||||
*
|
*
|
||||||
* It's safe to call this method from any thread.
|
* It's safe to call this method from any thread before ThreadedBackend's
|
||||||
|
* DoTerminate() implementation is invoked.
|
||||||
*
|
*
|
||||||
* @param messages Messages to be enqueued.
|
* @param messages Messages to be enqueued.
|
||||||
*/
|
*/
|
||||||
|
@ -582,6 +583,17 @@ protected:
|
||||||
*/
|
*/
|
||||||
bool DoInit() override;
|
bool DoInit() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common DoTerminate() functionality for threaded backends.
|
||||||
|
*
|
||||||
|
* The default DoTerminate() implementation of ThreadedBackend
|
||||||
|
* runs OnLoop's Process() once to drain any pending messages, then
|
||||||
|
* closes and unsets it.
|
||||||
|
*
|
||||||
|
* Classes deriving from ThreadedBackend need to ensure that all threads
|
||||||
|
* calling QeueuForProcessing() have terminated before invoking the
|
||||||
|
* ThreadedBackend's DoTerminate() implementation.
|
||||||
|
*/
|
||||||
void DoTerminate() override;
|
void DoTerminate() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue