mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
make heart beat interval for threading configureable from scripting layer
This commit is contained in:
parent
4558195dab
commit
6a60f484f9
4 changed files with 15 additions and 2 deletions
|
@ -1484,6 +1484,14 @@ export {
|
|||
};
|
||||
} # end export
|
||||
|
||||
module Threading;
|
||||
|
||||
export {
|
||||
## The heart beat interval used by the threading framework.
|
||||
## Changing this should usually not be neccessary and will break several tests.
|
||||
const heart_beat_interval = 1.0 &redef;
|
||||
}
|
||||
|
||||
module GLOBAL;
|
||||
|
||||
## An NTP message.
|
||||
|
|
|
@ -12,3 +12,4 @@ const NFS3::return_data: bool;
|
|||
const NFS3::return_data_max: count;
|
||||
const NFS3::return_data_first_only: bool;
|
||||
|
||||
const Threading::heart_beat_interval: double;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "Manager.h"
|
||||
#include "NetVar.h"
|
||||
|
||||
using namespace threading;
|
||||
|
||||
|
@ -11,6 +12,9 @@ Manager::Manager()
|
|||
next_beat = 0;
|
||||
terminating = false;
|
||||
idle = false;
|
||||
|
||||
heart_beat_interval = double(BifConst::Threading::heart_beat_interval);
|
||||
DBG_LOG(DBG_THREADING, "Heart beat interval set to %f", heart_beat_interval);
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
|
@ -73,7 +77,7 @@ void Manager::GetFds(int* read, int* write, int* except)
|
|||
double Manager::NextTimestamp(double* network_time)
|
||||
{
|
||||
if ( ::network_time && ! next_beat )
|
||||
next_beat = ::network_time + HEART_BEAT_INTERVAL;
|
||||
next_beat = ::network_time + heart_beat_interval;
|
||||
|
||||
// fprintf(stderr, "N %.6f %.6f did_process=%d next_next=%.6f\n", ::network_time, timer_mgr->Time(), (int)did_process, next_beat);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ protected:
|
|||
virtual const char* Tag() { return "threading::Manager"; }
|
||||
|
||||
private:
|
||||
static const int HEART_BEAT_INTERVAL = 1;
|
||||
int heart_beat_interval;
|
||||
|
||||
typedef std::list<BasicThread*> all_thread_list;
|
||||
all_thread_list all_threads;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue