|
LRAUV
revA
|
Protected Caller. More...
#include <PCaller.h>

Classes | |
| class | Initializer |
| struct | PCallOperation |
Public Types | |
| enum | PCallOperationType { BLOCK_NO_OPERATION, BLOCK_INITIALIZE, BLOCK_EXECUTE, BLOCK_EXECUTE_IF_UNSATISFIED, BLOCK_UNINITIALIZE, PCALLER_START, PCALLER_TERMINATE } |
Public Member Functions | |
| PCaller (bool idleThread, Logger &logger) | |
| Constructor. More... | |
| virtual | ~PCaller () |
| Destructor. More... | |
| bool | pInitialize (Component &component) |
| bool | pExecute (Component &component) |
| bool | pExecuteIfUnsatisfied (Behavior &component, bool &satisfied) |
| bool | pUninitialize (Component &component) |
Private Member Functions | |
| bool | startThread () |
| void | stopThread () |
| bool | pCall (Component &component, PCallOperationType operation, bool *returnValue) |
| Executes the specified method of this component with signal catching Returns true on normal run termination, false if a signal has occurred. More... | |
| void | containedWait () |
| The entry point for the protected thread. More... | |
| void | ownerWait () |
| Wait for another thread to activate this thread. More... | |
| void | yieldToContained () |
| Just yield execution to the waiting contained thread. More... | |
| void | yieldToOwner () |
| Just yield execution to the waiting owner thread. More... | |
| PCaller (const PCaller &old) | |
Static Private Member Functions | |
| static void | ShowInfo (Component *component, int signal, int errno, int code, size_t addr, size_t backtraceCount, char **backtraceStrings) |
| static const char * | PCallOperationToChars (const PCallOperationType operation) |
| static void * | PThreadRun (void *pCaller) |
| static void | RegisterDefaultSignals (void) |
| static void | DefaultSignalHandler (int signal, siginfo_t *sigIngo, void *context) |
| static const char * | SignalMessage (int signal, int code) |
Private Attributes | |
| Logger & | logger_ |
| Mutex | pCallMutex_ |
| Mutex | threadConditionMutex_ |
| ThreadCondition | threadCondition_ |
| pthread_t | containedThread_ |
| pthread_t | ownerThread_ |
| pthread_t | runningThread_ |
| Component * | currentComponent_ |
| PCallOperation | currentOperation_ |
| pthread_attr_t | threadAttributes_ |
| bool | threadRunning_ |
| bool | threadDone_ |
| bool | idle_ |
Static Private Attributes | |
| static Initializer | Initializer_ |
| Runs static intialization code. More... | |
| static FlexArray< PCaller * > | PCallers_ |
Protected Caller.
Can be used by a Handler or Component to make signal-handling protected calls to the execute(), initialize(), or uninitialize() methods of a component.
| PCaller::PCaller | ( | bool | idleThread, |
| Logger & | logger | ||
| ) |
|
virtual |
|
private |
|
private |
The entry point for the protected thread.
A static function. Wait for another thread to activate this thread.
References Mutex::lock(), runningThread_, threadCondition_, threadConditionMutex_, Mutex::unlock(), and ThreadCondition::wait().
Referenced by PThreadRun().
|
staticprivate |
|
private |
Wait for another thread to activate this thread.
References Mutex::lock(), runningThread_, threadCondition_, threadConditionMutex_, Mutex::unlock(), and ThreadCondition::wait().
Referenced by pCall(), and startThread().
|
private |
Executes the specified method of this component with signal catching Returns true on normal run termination, false if a signal has occurred.
References BLOCK_EXECUTE, BLOCK_EXECUTE_IF_UNSATISFIED, BLOCK_INITIALIZE, BLOCK_UNINITIALIZE, PCaller::PCallOperation::component_, currentComponent_, currentOperation_, Component::getRunState(), Component::isFailed(), Component::isFailureUninitialized(), Component::isUsingRunState(), Mutex::lock(), PCaller::PCallOperation::operation_, ownerThread_, ownerWait(), pCallMutex_, Component::requestStart(), Component::requestStop(), PCaller::PCallOperation::returnValue_, Component::setFailureUninitialized(), startThread(), Component::STOPPED, threadRunning_, Mutex::unlock(), and yieldToContained().
Referenced by pExecute(), pExecuteIfUnsatisfied(), pInitialize(), and pUninitialize().
|
staticprivate |
|
inline |
References BLOCK_EXECUTE, and pCall().
Referenced by Handler::run(), and MultiHandler::runNext().
|
inline |
References BLOCK_EXECUTE_IF_UNSATISFIED, and pCall().
|
inline |
References BLOCK_INITIALIZE, and pCall().
Referenced by MultiHandler::addComponent(), and Handler::run().
|
staticprivate |
References BLOCK_EXECUTE, BLOCK_EXECUTE_IF_UNSATISFIED, BLOCK_INITIALIZE, BLOCK_NO_OPERATION, BLOCK_UNINITIALIZE, PCaller::PCallOperation::component_, containedThread_, containedWait(), currentOperation_, Component::execute(), Behavior::executeIfUnsatisfied(), Syslog::INFO, Component::initialize(), logger_, PCaller::PCallOperation::operation_, PCALLER_START, PCALLER_TERMINATE, PCaller::PCallOperation::returnValue_, Logger::syslog(), threadDone_, Component::uninitialize(), and yieldToOwner().
Referenced by startThread().
|
inline |
References BLOCK_UNINITIALIZE, and pCall().
Referenced by Handler::run(), and MultiHandler::shutdown().
|
staticprivate |
References DefaultSignalHandler().
Referenced by PCaller::Initializer::Initializer().
|
staticprivate |
References Syslog::CRITICAL, Component::getLogger(), SignalMessage(), and Logger::syslog().
Referenced by DefaultSignalHandler().
|
staticprivate |
Referenced by DefaultSignalHandler(), and ShowInfo().
|
private |
|
private |
References containedThread_, and threadRunning_.
Referenced by startThread(), and ~PCaller().
|
private |
Just yield execution to the waiting contained thread.
References containedThread_, Mutex::lock(), runningThread_, ThreadCondition::signal(), threadCondition_, threadConditionMutex_, and Mutex::unlock().
Referenced by pCall(), startThread(), and ~PCaller().
|
private |
Just yield execution to the waiting owner thread.
References Mutex::lock(), ownerThread_, runningThread_, ThreadCondition::signal(), threadCondition_, threadConditionMutex_, and Mutex::unlock().
Referenced by DefaultSignalHandler(), and PThreadRun().
|
private |
Referenced by DefaultSignalHandler(), PThreadRun(), startThread(), stopThread(), yieldToContained(), and ~PCaller().
|
private |
Referenced by DefaultSignalHandler(), pCall(), and ~PCaller().
|
private |
Referenced by pCall(), PCaller(), PThreadRun(), startThread(), and ~PCaller().
|
private |
Referenced by startThread().
|
staticprivate |
Runs static intialization code.
|
private |
Referenced by PThreadRun(), and startThread().
|
private |
Referenced by pCall(), and yieldToOwner().
Referenced by DefaultSignalHandler(), PCaller(), and ~PCaller().
|
private |
Referenced by containedWait(), ownerWait(), yieldToContained(), and yieldToOwner().
|
private |
Referenced by PCaller(), startThread(), and ~PCaller().
|
private |
Referenced by containedWait(), ownerWait(), yieldToContained(), and yieldToOwner().
|
private |
Referenced by containedWait(), ownerWait(), yieldToContained(), and yieldToOwner().
|
private |
Referenced by PThreadRun().
|
private |
Referenced by DefaultSignalHandler(), pCall(), startThread(), stopThread(), and ~PCaller().