distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
Thread.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_THREAD_HPP_
13 #define INCLUDE_DISTORTOS_THREAD_HPP_
14 
16 
18 #include "distortos/SignalSet.hpp"
20 
21 #include <csignal>
22 
23 namespace distortos
24 {
25 
32 class Thread
33 {
34 public:
35 
40  virtual ~Thread() = 0;
41 
42 #ifdef CONFIG_THREAD_DETACH_ENABLE
43 
58  virtual int detach() = 0;
59 
60 #endif // def CONFIG_THREAD_DETACH_ENABLE
61 
62 #if CONFIG_SIGNALS_ENABLE == 1
63 
81  virtual int generateSignal(uint8_t signalNumber) = 0;
82 
83 #endif // CONFIG_SIGNALS_ENABLE == 1
84 
89  virtual uint8_t getEffectivePriority() const = 0;
90 
91 #if CONFIG_SIGNALS_ENABLE == 1
92 
105  virtual SignalSet getPendingSignalSet() const = 0;
106 
107 #endif // CONFIG_SIGNALS_ENABLE == 1
108 
113  virtual uint8_t getPriority() const = 0;
114 
119  virtual SchedulingPolicy getSchedulingPolicy() const = 0;
120 
125  virtual size_t getStackHighWaterMark() const = 0;
126 
131  virtual size_t getStackSize() const = 0;
132 
137  virtual ThreadState getState() const = 0;
138 
158  virtual int join() = 0;
159 
160 #if CONFIG_SIGNALS_ENABLE == 1
161 
182  virtual int queueSignal(uint8_t signalNumber, sigval value) = 0;
183 
184 #endif // CONFIG_SIGNALS_ENABLE == 1
185 
197  virtual void setPriority(uint8_t priority, bool alwaysBehind = {}) = 0;
198 
203  virtual void setSchedulingPolicy(SchedulingPolicy schedulingPolicy) = 0;
204 };
205 
206 } // namespace distortos
207 
208 #endif // INCLUDE_DISTORTOS_THREAD_HPP_
virtual int detach()=0
Detaches the thread.
Definition: signal.h:28
virtual ThreadState getState() const =0
virtual void setSchedulingPolicy(SchedulingPolicy schedulingPolicy)=0
virtual size_t getStackSize() const =0
SchedulingPolicy
scheduling policy of the thread
Definition: SchedulingPolicy.hpp:26
SignalSet class header.
ThreadState enum class header.
virtual size_t getStackHighWaterMark() const =0
virtual SchedulingPolicy getSchedulingPolicy() const =0
virtual uint8_t getEffectivePriority() const =0
distortos configuration
virtual uint8_t getPriority() const =0
SignalSet class is used as a set of signals.
Definition: SignalSet.hpp:28
Top-level namespace of distortos project.
virtual ~Thread()=0
Thread&#39;s destructor.
Definition: Thread.cpp:21
virtual void setPriority(uint8_t priority, bool alwaysBehind={})=0
Changes priority of thread.
virtual SignalSet getPendingSignalSet() const =0
Gets set of currently pending signals.
virtual int queueSignal(uint8_t signalNumber, sigval value)=0
Queues signal for thread.
virtual int generateSignal(uint8_t signalNumber)=0
Generates signal for thread.
virtual int join()=0
Waits for thread termination.
Thread class is a pure abstract interface for threads.
Definition: Thread.hpp:32
ThreadState
state of the thread
Definition: ThreadState.hpp:28
SchedulingPolicy enum class header.