distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
SignalsReceiverControlBlock.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SIGNALSRECEIVERCONTROLBLOCK_HPP_
13 #define INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SIGNALSRECEIVERCONTROLBLOCK_HPP_
14 
15 #include "distortos/SignalSet.hpp"
16 
17 #include <cstdint>
18 
19 union sigval;
20 
21 namespace distortos
22 {
23 
24 class SignalAction;
25 class SignalInformation;
26 class SignalInformationQueueWrapper;
27 class SignalsCatcher;
28 
29 namespace internal
30 {
31 
32 class SignalInformationQueue;
33 class SignalsCatcherControlBlock;
34 class ThreadControlBlock;
35 
38 {
39 public:
40 
50  explicit SignalsReceiverControlBlock(SignalInformationQueueWrapper* signalInformationQueueWrapper,
51  SignalsCatcher* signalsCatcher);
52 
68  std::pair<int, SignalInformation> acceptPendingSignal(uint8_t signalNumber);
69 
81  int deliveryOfSignalsStartedHook() const;
82 
99  int generateSignal(uint8_t signalNumber, ThreadControlBlock& threadControlBlock);
100 
106 
120  std::pair<int, SignalAction> getSignalAction(uint8_t signalNumber) const;
121 
130  SignalSet getSignalMask() const;
131 
151  int queueSignal(uint8_t signalNumber, sigval value, ThreadControlBlock& threadControlBlock) const;
152 
169  std::pair<int, SignalAction> setSignalAction(uint8_t signalNumber, const SignalAction& signalAction);
170 
185  int setSignalMask(SignalSet signalMask, bool requestDelivery);
186 
191  void setWaitingSignalSet(const SignalSet* const signalSet)
192  {
193  waitingSignalSet_ = signalSet;
194  }
195 
196 private:
197 
211  std::pair<int, bool> isSignalIgnored(uint8_t signalNumber) const;
212 
225  int postGenerate(uint8_t signalNumber, ThreadControlBlock& threadControlBlock) const;
226 
229 
232 
235 
238 };
239 
240 } // namespace internal
241 
242 } // namespace distortos
243 
244 #endif // INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SIGNALSRECEIVERCONTROLBLOCK_HPP_
Definition: signal.h:28
std::pair< int, SignalAction > setSignalAction(uint8_t signalNumber, const SignalAction &signalAction)
Sets association for given signal number.
Definition: SignalsReceiverControlBlock.cpp:137
ThreadControlBlock class is a simple description of a Thread.
Definition: ThreadControlBlock.hpp:40
SignalsCatcherControlBlock class is a structure required by threads for "catching" and "handling" of ...
Definition: SignalsCatcherControlBlock.hpp:29
SignalsReceiverControlBlock(SignalInformationQueueWrapper *signalInformationQueueWrapper, SignalsCatcher *signalsCatcher)
SignalsReceiverControlBlock&#39;s constructor.
Definition: SignalsReceiverControlBlock.cpp:34
void setWaitingSignalSet(const SignalSet *const signalSet)
Definition: SignalsReceiverControlBlock.hpp:191
SignalInformationQueue * signalInformationQueue_
pointer to SignalInformationQueue for this receiver, nullptr if this receiver cannot queue signals ...
Definition: SignalsReceiverControlBlock.hpp:237
SignalSet class header.
int deliveryOfSignalsStartedHook() const
Hook function executed when delivery of signals is started.
Definition: SignalsReceiverControlBlock.cpp:66
SignalsReceiverControlBlock class is a structure required by threads for "receiving" of signals...
Definition: SignalsReceiverControlBlock.hpp:37
std::pair< int, SignalInformation > acceptPendingSignal(uint8_t signalNumber)
Accepts (clears) one of signals that are pending.
Definition: SignalsReceiverControlBlock.cpp:48
SignalsCatcherControlBlock * signalsCatcherControlBlock_
pointer to SignalsCatcherControlBlock for this receiver, nullptr if this receiver cannot catch/handle...
Definition: SignalsReceiverControlBlock.hpp:234
SignalSet class is used as a set of signals.
Definition: SignalSet.hpp:28
Top-level namespace of distortos project.
int postGenerate(uint8_t signalNumber, ThreadControlBlock &threadControlBlock) const
Actions executed after signal is "generated" with generateSignal() or queueSignal().
Definition: SignalsReceiverControlBlock.cpp:185
SignalSet getSignalMask() const
Gets signal mask for associated thread.
Definition: SignalsReceiverControlBlock.cpp:108
SignalInformationQueue class can be used for queuing of SignalInformation objects.
Definition: SignalInformationQueue.hpp:30
SignalSet pendingSignalSet_
set of pending signals
Definition: SignalsReceiverControlBlock.hpp:228
int setSignalMask(SignalSet signalMask, bool requestDelivery)
Sets signal mask for associated thread.
Definition: SignalsReceiverControlBlock.cpp:157
std::pair< int, bool > isSignalIgnored(uint8_t signalNumber) const
Checks whether signal is ignored.
Definition: SignalsReceiverControlBlock.cpp:169
const SignalSet * waitingSignalSet_
pointer to set of "waited for" signals, nullptr if associated thread is not waiting for any signals ...
Definition: SignalsReceiverControlBlock.hpp:231
SignalAction class contains information needed to handle signal that was caught.
Definition: SignalAction.hpp:30
SignalInformationQueueWrapper class is a container for internal::SignalInformationQueue.
Definition: SignalInformationQueueWrapper.hpp:28
SignalSet getPendingSignalSet() const
Definition: SignalsReceiverControlBlock.cpp:90
std::pair< int, SignalAction > getSignalAction(uint8_t signalNumber) const
Gets SignalAction associated with given signal number.
Definition: SignalsReceiverControlBlock.cpp:100
int queueSignal(uint8_t signalNumber, sigval value, ThreadControlBlock &threadControlBlock) const
Queues signal for associated thread.
Definition: SignalsReceiverControlBlock.cpp:116
int generateSignal(uint8_t signalNumber, ThreadControlBlock &threadControlBlock)
Generates signal for associated thread.
Definition: SignalsReceiverControlBlock.cpp:75
SignalsCatcher class is a container for internal::SignalsCatcherControlBlock.
Definition: SignalsCatcher.hpp:28