distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
ThisThread-Signals.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_THISTHREAD_SIGNALS_HPP_
13 #define INCLUDE_DISTORTOS_THISTHREAD_SIGNALS_HPP_
14 
16 
17 #if CONFIG_SIGNALS_ENABLE == 1
18 
20 #include "distortos/TickClock.hpp"
21 
22 #include <utility>
23 
24 #include <cstdint>
25 
26 namespace distortos
27 {
28 
29 class SignalAction;
30 class SignalSet;
31 
32 namespace ThisThread
33 {
34 
35 namespace Signals
36 {
37 
40 
56 int generateSignal(uint8_t signalNumber);
57 
70 SignalSet getPendingSignalSet();
71 
87 std::pair<int, SignalAction> getSignalAction(uint8_t signalNumber);
88 
99 SignalSet getSignalMask();
100 
117 int queueSignal(uint8_t signalNumber, sigval value);
118 
136 std::pair<int, SignalAction> setSignalAction(uint8_t signalNumber, const SignalAction& signalAction);
137 
152 int setSignalMask(SignalSet signalMask);
153 
172 std::pair<int, SignalInformation> tryWait(const SignalSet& signalSet);
173 
193 std::pair<int, SignalInformation> tryWaitFor(const SignalSet& signalSet, TickClock::duration duration);
194 
213 template<typename Rep, typename Period>
214 std::pair<int, SignalInformation> tryWaitFor(const SignalSet& signalSet,
215  const std::chrono::duration<Rep, Period> duration)
216 {
217  return tryWaitFor(signalSet, std::chrono::duration_cast<TickClock::duration>(duration));
218 }
219 
239 std::pair<int, SignalInformation> tryWaitUntil(const SignalSet& signalSet, TickClock::time_point timePoint);
240 
258 template<typename Duration>
259 std::pair<int, SignalInformation> tryWaitUntil(const SignalSet& signalSet,
260  const std::chrono::time_point<TickClock, Duration> timePoint)
261 {
262  return tryWaitUntil(signalSet, std::chrono::time_point_cast<TickClock::duration>(timePoint));
263 }
264 
283 std::pair<int, SignalInformation> wait(const SignalSet& signalSet);
284 
286 
287 } // namespace Signals
288 
289 } // namespace ThisThread
290 
291 } // namespace distortos
292 
293 #endif // CONFIG_SIGNALS_ENABLE == 1
294 
295 #endif // INCLUDE_DISTORTOS_THISTHREAD_SIGNALS_HPP_
Definition: signal.h:28
SignalSet getSignalMask()
Gets signal mask for current thread.
Definition: ThisThread-Signals.cpp:170
std::pair< int, SignalAction > getSignalAction(uint8_t signalNumber)
Gets SignalAction associated with given signal number.
Definition: ThisThread-Signals.cpp:157
std::pair< int, SignalInformation > tryWaitUntil(const SignalSet &signalSet, TickClock::time_point timePoint)
Tries to wait for signals until given time point.
Definition: ThisThread-Signals.cpp:222
int setSignalMask(SignalSet signalMask)
Sets signal mask for current thread.
Definition: ThisThread-Signals.cpp:200
SignalSet getPendingSignalSet()
Gets set of currently pending signals for current thread.
Definition: ThisThread-Signals.cpp:152
std::chrono::time_point< TickClock > time_point
basic time_point type of clock
Definition: TickClock.hpp:42
std::pair< int, SignalAction > setSignalAction(uint8_t signalNumber, const SignalAction &signalAction)
Sets association for given signal number.
Definition: ThisThread-Signals.cpp:187
TickClock class header.
distortos configuration
SignalSet class is used as a set of signals.
Definition: SignalSet.hpp:28
std::pair< int, SignalInformation > tryWaitFor(const SignalSet &signalSet, TickClock::duration duration)
Tries to wait for signals for given duration of time.
Definition: ThisThread-Signals.cpp:217
Top-level namespace of distortos project.
std::pair< int, SignalInformation > tryWait(const SignalSet &signalSet)
Tries to accept pending signals.
Definition: ThisThread-Signals.cpp:212
std::chrono::duration< rep, period > duration
basic duration type of clock
Definition: TickClock.hpp:39
SignalInformation class header.
int generateSignal(uint8_t signalNumber)
Generates signal for current thread.
Definition: ThisThread-Signals.cpp:147
int queueSignal(uint8_t signalNumber, sigval value)
Queues signal for current thread.
Definition: ThisThread-Signals.cpp:182
std::pair< int, SignalInformation > wait(const SignalSet &signalSet)
Waits for signals.
Definition: ThisThread-Signals.cpp:227