SignalsCatcherControlBlock class is a structure required by threads for "catching" and "handling" of signals.
More...
#include "distortos/internal/synchronization/SignalsCatcherControlBlock.hpp"
SignalsCatcherControlBlock class is a structure required by threads for "catching" and "handling" of signals.
◆ Association
◆ Storage
type of uninitialized storage for Association objects
◆ StorageUniquePointer
unique_ptr (with deleter) to Storage[]
◆ SignalsCatcherControlBlock()
distortos::internal::SignalsCatcherControlBlock::SignalsCatcherControlBlock |
( |
StorageUniquePointer && |
storageUniquePointer, |
|
|
size_t |
storageSize |
|
) |
| |
SignalsCatcherControlBlock's constructor.
- Parameters
-
[in] | storageUniquePointer | is a rvalue reference to StorageUniquePointer with storage for Association objects (sufficiently large for storageSize elements) and appropriate deleter |
[in] | storageSize | is the number of elements in storage array |
◆ ~SignalsCatcherControlBlock()
distortos::internal::SignalsCatcherControlBlock::~SignalsCatcherControlBlock |
( |
| ) |
|
◆ afterGenerateQueueUnlocked()
void distortos::internal::SignalsCatcherControlBlock::afterGenerateQueueUnlocked |
( |
ThreadControlBlock & |
threadControlBlock | ) |
|
Part of SignalsReceiverControlBlock::afterGenerateQueueUnlocked() specific to catching unmasked signals.
This function does nothing if the request is for non-current thread of execution. Otherwise it delivers signals to current thread.
- Note
- It is assumed that some unmasked signal with non-default signal handler is pending.
- Parameters
-
◆ beforeGenerateQueue()
int distortos::internal::SignalsCatcherControlBlock::beforeGenerateQueue |
( |
ThreadControlBlock & |
threadControlBlock | ) |
|
Part of SignalsReceiverControlBlock::beforeGenerateQueue() specific to catching unmasked signals.
This function does nothing if the request is for current thread of execution. Otherwise it requests delivery of signals to associated thread.
- Note
- It is assumed that some unmasked signal with non-default signal handler will be pending before leaving critical section.
- Parameters
-
- Returns
- 0 on success, error code otherwise:
◆ clearAssociation() [1/2]
SignalAction distortos::internal::SignalsCatcherControlBlock::clearAssociation |
( |
uint8_t |
signalNumber | ) |
|
|
private |
Clears association for given signal number.
- Parameters
-
[in] | signalNumber | is the signal for which the association will be cleared, [0; 31] |
- Returns
- SignalAction that was associated with signalNumber, default-constructed object if no association was found
◆ clearAssociation() [2/2]
SignalAction distortos::internal::SignalsCatcherControlBlock::clearAssociation |
( |
uint8_t |
signalNumber, |
|
|
Association & |
association |
|
) |
| |
|
private |
Clears given association for given signal number.
- Parameters
-
[in] | signalNumber | is the signal for which the association will be cleared, [0; 31] |
[in] | association | is a reference to Association object from [associationsBegin_; associationsEnd_) range that will be removed |
- Returns
- SignalAction from association
◆ deliveryOfSignalsStartedHook()
void distortos::internal::SignalsCatcherControlBlock::deliveryOfSignalsStartedHook |
( |
| ) |
|
|
inline |
Hook function executed when delivery of signals is started.
Clears "delivery pending" flag.
- Attention
- This function should be called only by SignalsReceiverControlBlock::deliveryOfSignalsFinishedHook().
◆ getAssociation()
std::pair< int, SignalAction > distortos::internal::SignalsCatcherControlBlock::getAssociation |
( |
uint8_t |
signalNumber | ) |
const |
Gets SignalAction associated with given signal number.
- Parameters
-
[in] | signalNumber | is the signal for which the association is requested, [0; 31] |
- Returns
- pair with return code (0 on success, error code otherwise) and SignalAction that is associated with signalNumber, default-constructed object if no association was found; error codes:
- EINVAL - signalNumber value is invalid;
◆ getAssociationsBegin()
Association* distortos::internal::SignalsCatcherControlBlock::getAssociationsBegin |
( |
| ) |
const |
|
inlineprivate |
- Returns
- pointer to first element of range of Association objects
◆ getSignalMask()
SignalSet distortos::internal::SignalsCatcherControlBlock::getSignalMask |
( |
| ) |
const |
|
inline |
- Returns
- SignalSet with signal mask for associated thread
◆ requestDeliveryOfSignals()
int distortos::internal::SignalsCatcherControlBlock::requestDeliveryOfSignals |
( |
ThreadControlBlock & |
threadControlBlock | ) |
|
|
private |
Requests delivery of signals to associated thread.
Delivery of signals (via special function executed in the associated thread) is requested only if it's not already pending. The thread is unblocked if it was blocked.
- Parameters
-
- Returns
- 0 on success, error code otherwise:
◆ setAssociation()
std::pair< int, SignalAction > distortos::internal::SignalsCatcherControlBlock::setAssociation |
( |
uint8_t |
signalNumber, |
|
|
const SignalAction & |
signalAction |
|
) |
| |
Sets association for given signal number.
- Parameters
-
[in] | signalNumber | is the signal for which the association will be set, [0; 31] |
[in] | signalAction | is a reference to SignalAction that will be associated with given signal number, object in internal storage is copy-constructed |
- Returns
- pair with return code (0 on success, error code otherwise) and SignalAction that was associated with signalNumber, default-constructed object if no association was found; error codes:
- EAGAIN - no resources are available to associate signalNumber with signalAction;
- EINVAL - signalNumber value is invalid;
◆ setSignalMask()
Sets signal mask for associated thread.
If any pending signal is unblocked and owner doesn't equal nullptr, then pending and unblocked signals will be delivered.
- Parameters
-
[in] | signalMask | is the SignalSet with new signal mask for associated thread |
[in] | owner | selects whether pending and unblocked signals will be delivered (pointer to owner SignalsReceiverControlBlock object) or not (nullptr) |
◆ @17
union binds associationsEnd_ and storageBegin_ - these point to the same address
◆ associationsEnd_
Association* distortos::internal::SignalsCatcherControlBlock::associationsEnd_ |
pointer to "one past the last" element of range of Association objects
◆ deliveryIsPending_
bool distortos::internal::SignalsCatcherControlBlock::deliveryIsPending_ |
|
private |
true if signal delivery is pending, false otherwise
◆ signalMask_
SignalSet distortos::internal::SignalsCatcherControlBlock::signalMask_ |
|
private |
SignalSet with signal mask for associated thread.
◆ storageBegin_
Storage* distortos::internal::SignalsCatcherControlBlock::storageBegin_ |
pointer to first element of range of Storage objects
◆ storageEnd_
Storage* distortos::internal::SignalsCatcherControlBlock::storageEnd_ |
|
private |
pointer to "one past the last" element of range of Storage objects
◆ storageUniquePointer_
storage for Association objects
The documentation for this class was generated from the following files: