MADARA  3.2.3
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:
37  : priority (0), critical (false)
38  {
39 
40  }
41 
46  virtual void init (knowledge::Variables & vars)
47  {
48 
49  }
50 
54  virtual void run (void) = 0;
55 
63  virtual void cleanup (void)
64  {
65 
66  }
67 
68  private:
69 
73  int priority;
74 
78  bool critical;
79  };
80  }
81 }
82 
83 #endif // _MADARA_THREADS_WORK_UNIT_H_
WorkUnit()
Default constructor.
Definition: WorkUnit.h:36
virtual void init(knowledge::Variables &vars)
Initializes thread with MADARA context.
Definition: WorkUnit.h:46
Provides a quality-of-service-enabled threading library.
Definition: BaseThread.h:27
bool critical
Criticality.
Definition: WorkUnit.h:78
Abstract base class for implementing base threads.
Definition: WorkUnit.h:30
int priority
Task priority.
Definition: WorkUnit.h:73
virtual void cleanup(void)
Cleans up any thread residue (usually instances created in init).
Definition: WorkUnit.h:63
Copyright (c) 2015 Carnegie Mellon University.
virtual void run(void)=0
Executes the main thread logic.
Provides an interface for external functions into the MADARA KaRL variable settings.