MADARA  3.1.8
WorkerThread.inl
Go to the documentation of this file.
1 #ifndef _MADARA_THREADS_WORKER_THREAD_INL_
2 #define _MADARA_THREADS_WORKER_THREAD_INL_
3 
11 #include "WorkerThread.h"
12 
13 
14 inline void
16  double hertz,
17  ACE_Time_Value & current, ACE_Time_Value & frequency,
18  ACE_Time_Value & next_epoch,
19  bool & one_shot, bool & blaster)
20 {
21  hertz_ = hertz;
22  if (hertz_ > 0.0)
23  {
25  "WorkerThread(%s)::svc:" \
26  " thread repeating at %f hz\n", name_.c_str (), hertz_);
27 
28  one_shot = false;
29  frequency.set (1.0 / hertz_);
30  next_epoch = current + frequency;
31  }
32  else if (hertz_ == 0.0)
33  {
34  // infinite hertz until terminate
35 
37  "WorkerThread(%s)::svc:" \
38  " thread blasting at infinite hz\n", name_.c_str ());
39 
40  one_shot = false;
41  blaster = true;
42  }
43  else
44  {
46  "WorkerThread(%s)::svc:" \
47  " thread running once\n", name_.c_str ());
48  }
49 }
50 
51 #endif // _MADARA_THREADS_WORKER_THREAD_H_
double hertz_
hertz rate for worker thread executions
Definition: WorkerThread.h:133
MADARA_Export utility::Refcounter< logger::Logger > global_logger
void change_frequency(double hertz, ACE_Time_Value &current, ACE_Time_Value &frequency, ACE_Time_Value &next_epoch, bool &one_shot, bool &blaster)
Changes the frequency given a hertz rate.
#define madara_logger_ptr_log(logger, level,...)
Fast version of the madara::logger::log method for Logger pointers.
Definition: Logger.h:32
std::string name_
the name of the contained thread
Definition: WorkerThread.h:102