|
Open Model Railroad Network (OpenMRN)
|
Use this class to read from an fd with select and timeout. More...
#include <StateFlow.hxx>
Public Member Functions | |
| StateFlowTimedSelectHelper (StateFlowBase *parent) | |
| void | set_timed_wakeup () |
| Called from the stateflow's internal state to instruct to set the wakeup target for the timer. | |
Public Member Functions inherited from StateFlowBase::StateFlowSelectHelper | |
| StateFlowSelectHelper (StateFlowBase *parent) | |
Public Member Functions inherited from Selectable | |
| Selectable (Executable *parent) | |
| Constructor. | |
| void | reset (SelectType type, int fd, unsigned priority) |
| Re-initialize a Selectable preparing to add it to select(). | |
| bool | is_empty () |
| unsigned | priority () |
| SelectType | type () |
| Executable * | parent () |
| int | fd () |
| void | set_wakeup (Executable *e) |
| Can be used to override the executable to wake up. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Public Attributes | ||
| StateFlowTimer | timer_ | |
| This timer is used to wake up the StateFlow. | ||
| long long | expiry_ | |
| End of the wakeup timeout. | ||
Public Attributes inherited from StateFlowBase::StateFlowSelectHelper | ||
| union { | ||
| const uint8_t * wbuf_ | ||
| uint8_t * rbuf_ | ||
| }; | ||
| Callback | nextState_ | |
| State to transition to after the read is complete. | ||
| unsigned | readFully_: 1 | |
| 1 if we need to read until all remaining_ is consumed. | ||
| unsigned | readNonblocking_: 1 | |
| 1 if we need a non-blocking read, in other words, try once | ||
| unsigned | readWithTimeout_: 1 | |
| 1 if there is also a timer involved; in this case *this must be a StateFlowTimedSelectHelper. | ||
| unsigned | hasError_: 1 | |
| 1 if there was an error reading of writing. | ||
| unsigned | remaining_: 28 | |
| Number of bytes still outstanding to read. | ||
Private Member Functions | |
| void | run () override |
| Entry point. | |
Private Member Functions inherited from Executable | |
| void | test_deletion () |
| void | notify () override |
| Crashes the program – everyone who is expecting notify calls must override this function. | |
| virtual void | alloc_result (QMember *item) |
| Return the result of an alloc_async() from a memory Pool. | |
Private Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Additional Inherited Members | |
Public Types inherited from Selectable | |
| enum | SelectType { READ = 1 , WRITE = 2 , EXCEPT = 3 } |
| Which operation this file should be selected upon. More... | |
| enum | Limits { MAX_FD = (1 << 14) - 1 , MAX_PRIO = (1 << 16) - 1 } |
| Helper declarations for the certain fields' maximums. More... | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Private Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Use this class to read from an fd with select and timeout.
This clas encapsulates both a selecthelper and a timer. It is okay to use them separately and independently from each other as well, for example to do return sleep_and_call(&timedSelect_.timer_, ...).
Definition at line 895 of file StateFlow.hxx.
|
inline |
| parent | owning flow. |
Definition at line 899 of file StateFlow.hxx.
|
inlineoverrideprivatevirtual |
Entry point.
This funciton will be called when *this gets scheduled on the CPU.
Implements Executable.
Definition at line 927 of file StateFlow.hxx.
|
inline |
Called from the stateflow's internal state to instruct to set the wakeup target for the timer.
Definition at line 907 of file StateFlow.hxx.
| long long StateFlowBase::StateFlowTimedSelectHelper::expiry_ |
End of the wakeup timeout.
We need to store this separately because each immediate select return will cancel the timer. This is in absolute time.
Definition at line 923 of file StateFlow.hxx.
| StateFlowTimer StateFlowBase::StateFlowTimedSelectHelper::timer_ |
This timer is used to wake up the StateFlow.
In general if the timer expires first, it will notify the stateflow directly. If the select expires first, it will cause code to run that trigger()'s this timer.
It is okay to use this timer for other purposes in the same stateflow when there is no read_with_timeout in operation.
Definition at line 918 of file StateFlow.hxx.