MADARA  3.1.8
Threader.h
Go to the documentation of this file.
1 
2 
3 #ifndef _MADARA_THREADS_THREADER_H_
4 #define _MADARA_THREADS_THREADER_H_
5 
14 #include <string>
15 #include <vector>
16 #include <map>
17 #include <list>
19 #include "BaseThread.h"
20 #include "WorkerThread.h"
21 #include "madara/MADARA_export.h"
22 
23 #ifdef _MADARA_JAVA_
24 #include <jni.h>
25 #include "madara_jni.h"
26 #endif
27 
28 namespace madara
29 {
30  namespace threads
31  {
35  class MADARA_Export Threader
36  {
37  public:
41  Threader ();
42 
47  Threader (knowledge::KnowledgeBase & data_plane);
48 
52  ~Threader ();
53 
64  void change_hertz (const std::string name, double hertz);
65 
70  knowledge::KnowledgeBase get_control_plane (void);
71 
76  knowledge::KnowledgeBase get_data_plane (void);
77 
82  void pause (const std::string name);
83 
87  void pause (void);
88 
93  void resume (const std::string name);
94 
98  void resume (void);
99 
114  void run (const std::string name, BaseThread * thread,
115  bool paused = false);
116 
136  void run (double hertz, const std::string name, BaseThread * thread,
137  bool paused = false);
138 
139 #ifdef _MADARA_JAVA_
140 
155  void run (const std::string name, jobject thread, bool paused = false);
156 
176  void run (double hertz, const std::string name, jobject thread,
177  bool paused = false);
178 
179 #endif
180 
185  void set_data_plane (knowledge::KnowledgeBase & data_plane);
186 
191  void terminate (const std::string name);
192 
196  void terminate (void);
197 
204  bool wait (const std::string name,
206 
212  bool wait (
214 
215  private:
216 
221 
228 
233  };
234  }
235 }
236 
237 #include "Threader.inl"
238 
239 #endif // _MADARA_THREADS_THREADER_H_
NamedWorkerThreads threads_
the threads that are still active
Definition: Threader.h:232
Provides a quality-of-service-enabled threading library.
Definition: BaseThread.h:27
Abstract base class for implementing threads.
Definition: BaseThread.h:38
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
knowledge::KnowledgeBase * control_
The control plane used by threads for termination and pause information.
Definition: Threader.h:227
static constexpr struct madara::knowledge::tags::string_t string
Starts threads with first class support of MADARA contexts.
Definition: Threader.h:35
std::map< std::string, WorkerThread * > NamedWorkerThreads
Collection of named threads.
Definition: WorkerThread.h:139
knowledge::KnowledgeBase * data_
The data plane used by threads.
Definition: Threader.h:220
Copyright (c) 2015 Carnegie Mellon University.
Encapsulates settings for a wait statement.
Definition: WaitSettings.h:23