mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Modify IOSource Manager to implement new loop architecture
- Removes entire FindSoonest method that includes all of the calls to select() for checking for ready sources - Removes FD_Set checking against IOSources - Adds system for registering and unregistering file descriptors from IOSources. This allows individual sources to mark themselves as ready to be checked by the loop as they become available. - Adds entirely new loop architecture based on checking the IOSources for when their next timeout is, and then waiting for either that timeout or when the next source is ready. This also implements the polling based on what the OS supports, instead of just calling select() on all platforms. Currently it supports kqueue, epoll, and plain poll. - Adds system for pinging the loop to force it to wake up
This commit is contained in:
parent
062cadb124
commit
4fa3e4b9b4
12 changed files with 364 additions and 200 deletions
11
src/main.cc
11
src/main.cc
|
@ -256,6 +256,8 @@ void terminate_bro()
|
|||
|
||||
terminating = true;
|
||||
|
||||
iosource_mgr->Wakeup("terminate_bro");
|
||||
|
||||
// File analysis termination may produce events, so do it early on in
|
||||
// the termination process.
|
||||
file_mgr->Terminate();
|
||||
|
@ -332,6 +334,9 @@ RETSIGTYPE sig_handler(int signo)
|
|||
set_processing_status("TERMINATING", "sig_handler");
|
||||
signal_val = signo;
|
||||
|
||||
if ( ! terminating )
|
||||
iosource_mgr->Wakeup("sig_handler");
|
||||
|
||||
return RETSIGVAL;
|
||||
}
|
||||
|
||||
|
@ -662,6 +667,7 @@ int main(int argc, char** argv)
|
|||
if ( reporter->Errors() > 0 )
|
||||
exit(1);
|
||||
|
||||
iosource_mgr->InitPostScript();
|
||||
plugin_mgr->InitPostScript();
|
||||
zeekygen_mgr->InitPostScript();
|
||||
broker_mgr->InitPostScript();
|
||||
|
@ -878,11 +884,6 @@ int main(int argc, char** argv)
|
|||
|
||||
have_pending_timers = ! reading_traces && timer_mgr->Size() > 0;
|
||||
|
||||
iosource_mgr->Register(thread_mgr, true);
|
||||
|
||||
if ( zeek::supervisor_mgr )
|
||||
iosource_mgr->Register(zeek::supervisor_mgr);
|
||||
|
||||
if ( iosource_mgr->Size() > 0 ||
|
||||
have_pending_timers ||
|
||||
BifConst::exit_only_after_terminate )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue