MADARA  3.4.1
WorkUnit.h
Go to the documentation of this file.
1 
2 
3 #ifndef _MADARA_THREADS_WORK_UNIT_H_
4 #define _MADARA_THREADS_WORK_UNIT_H_
5 
13 #include <string>
14 #include <vector>
15 #include <map>
16 #include <list>
19 #include "madara/utility/StdInt.h"
20 #include "madara/MadaraExport.h"
22 
23 namespace madara
24 {
25 namespace threads
26 {
30 class WorkUnit
31 {
32 public:
36  WorkUnit() : priority(0), critical(false) {}
37 
42  virtual void init(knowledge::Variables& vars) {}
43 
47  virtual void run(void) = 0;
48 
56  virtual void cleanup(void) {}
57 
58 private:
62  int priority;
63 
67  bool critical;
68 };
69 }
70 }
71 
72 #endif // _MADARA_THREADS_WORK_UNIT_H_
Provides an interface for external functions into the MADARA KaRL variable settings.
Definition: Variables.h:53
Abstract base class for implementing base threads.
Definition: WorkUnit.h:31
int priority
Task priority.
Definition: WorkUnit.h:62
virtual void run(void)=0
Executes the main thread logic.
bool critical
Criticality.
Definition: WorkUnit.h:67
WorkUnit()
Default constructor.
Definition: WorkUnit.h:36
virtual void cleanup(void)
Cleans up any thread residue (usually instances created in init).
Definition: WorkUnit.h:56
virtual void init(knowledge::Variables &vars)
Initializes thread with MADARA context.
Definition: WorkUnit.h:42
Provides a quality-of-service-enabled threading library.
Definition: BaseThread.h:28
Copyright(c) 2020 Galois.