MADARA  3.2.3
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/MadaraExport.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 
48 
52  ~Threader ();
53 
54  Threader(const Threader &) = delete;
55  Threader(Threader &&) = default;
56  Threader &operator=(const Threader &) = delete;
57  Threader &operator=(Threader &&) = default;
58 
69  void change_hertz (const std::string name, double hertz);
70 
75  knowledge::KnowledgeBase get_control_plane (void);
76 
81  knowledge::KnowledgeBase get_data_plane (void);
82 
87  void pause (const std::string name);
88 
92  void pause (void);
93 
98  void resume (const std::string name);
99 
103  void resume (void);
104 
120  void run (const std::string name, BaseThread * thread,
121  bool paused = false);
122 
143  void run (double hertz, const std::string name, BaseThread * thread,
144  bool paused = false);
145 
146 #ifdef _MADARA_JAVA_
147 
162  void run (const std::string name, jobject thread, bool paused = false);
163 
183  void run (double hertz, const std::string name, jobject thread,
184  bool paused = false);
185 
186 #endif
187 
192  void set_data_plane (knowledge::KnowledgeBase data_plane);
193 
198  void terminate (const std::string name);
199 
203  void terminate (void);
204 
211  bool wait (const std::string name,
213 
219  bool wait (
221 
222  private:
223 
228 
235 
240  };
241  }
242 }
243 
244 #include "Threader.inl"
245 
246 #endif // _MADARA_THREADS_THREADER_H_
knowledge::KnowledgeBase control_
The control plane used by threads for termination and pause information.
Definition: Threader.h:234
NamedWorkerThreads threads_
the threads that are still active
Definition: Threader.h:239
Provides a quality-of-service-enabled threading library.
Definition: BaseThread.h:27
static struct madara::knowledge::tags::string_t string
Abstract base class for implementing threads.
Definition: BaseThread.h:38
knowledge::KnowledgeBase data_
The data plane used by threads.
Definition: Threader.h:227
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
Starts threads with first class support of MADARA contexts.
Definition: Threader.h:35
std::map< std::string, std::unique_ptr< WorkerThread > > NamedWorkerThreads
Collection of named threads.
Definition: WorkerThread.h:159
Copyright (c) 2015 Carnegie Mellon University.
Encapsulates settings for a wait statement.
Definition: WaitSettings.h:23