|
Open Model Railroad Network (OpenMRN)
|
Template-nonspecific base class for FdHubPort. More...
#include <HubDevice.hxx>
Classes | |
| class | ReadThreadBase |
| Read thread implementation with template-inspecific methods. More... | |
Public Member Functions | |
| FdHubPortBase (int fd, Notifiable *done) | |
| Constructor. | |
Public Member Functions inherited from FdHubPortInterface | |
| int | fd () |
Static Public Member Functions | |
| static void | fill_thread_name (char *buf, char mode, int fd) |
| Puts the desired thread name for the read or write thread. | |
Static Public Attributes | |
| static const int | kWriteThreadStackSize = 1000 |
| How many bytes of stack should we allocate to the write thread's stack. | |
| static const int | kReadThreadStackSize = 1000 |
| How many bytes of stack should we allocate to the read thread's stack. | |
Protected Member Functions | |
| const char * | fill_thread_name (char mode, int fd) |
| Puts the desired thread name for the read or write thread. | |
| virtual void | unregister_write_port ()=0 |
| Removes the write flow from the hub's registration. | |
| void | report_error () |
| Call when an IO error is encountered. | |
Protected Member Functions inherited from FdHubPortInterface | |
| FdHubPortInterface (int fd) | |
Protected Attributes | |
| char | threadName_ [30] |
| Temporary buffer used for rendering thread names. | |
| Executor< 1 > | writeThread_ |
| This executor is running the writes. | |
| Service | writeService_ |
| Service for the write flow. | |
| BarrierNotifiable | barrier_ |
| This barrier will be notified when both read and write thread has exited. | |
| unsigned | hasError_: 1 |
| If this is 1, the fd has been closed. | |
| unsigned | writeExitEnqueued_: 1 |
| If this is 1, we have already enqueued the request to exit the write flow. | |
Protected Attributes inherited from FdHubPortInterface | |
| int | fd_ {-1} |
| The device file descriptor. | |
Friends | |
| template<class Data > | |
| class | FdHubWriteFlow |
Additional Inherited Members | |
Private Member Functions inherited from Atomic | |
| void | lock () |
| void | unlock () |
Template-nonspecific base class for FdHubPort.
The purpose of this class is to avoid compiling this code multiple times for differently typed devices (and thus saving flash space).
Definition at line 48 of file HubDevice.hxx.
|
inline |
Constructor.
| fd | is the filedes to read/write |
| done | will be called when this file is closed and removed from the hub (usually due to an error). |
Definition at line 68 of file HubDevice.hxx.
|
inlinevirtual |
Definition at line 79 of file HubDevice.hxx.
|
static |
Puts the desired thread name for the read or write thread.
| buf | where to put ocmputed thread name. Must be at least 15 chars long. |
| mode | a character describing read ('R') or write ('W') |
| fd | filedes number that will be rendered into the thread name. |
Definition at line 96 of file HubDevice.cxx.
|
inlineprotected |
Puts the desired thread name for the read or write thread.
| mode | a character describing read ('R') or write ('W') |
| fd | filedes number that will be rendered into the thread name. |
Definition at line 98 of file HubDevice.hxx.
|
inlineprotected |
Call when an IO error is encountered.
Closes the FD, unregisters the port from the hub and causes the threads to exit.
Definition at line 110 of file HubDevice.hxx.
|
protectedpure virtual |
Removes the write flow from the hub's registration.
Triggers the write flow to call barrier_ when all the pending queue entries are released.
Implemented in FdHubPort< HFlow >.
|
friend |
Definition at line 195 of file HubDevice.hxx.
|
protected |
This barrier will be notified when both read and write thread has exited.
Definition at line 205 of file HubDevice.hxx.
|
protected |
If this is 1, the fd has been closed.
Definition at line 207 of file HubDevice.hxx.
|
static |
How many bytes of stack should we allocate to the read thread's stack.
Definition at line 61 of file HubDevice.hxx.
|
static |
How many bytes of stack should we allocate to the write thread's stack.
Definition at line 59 of file HubDevice.hxx.
|
protected |
Temporary buffer used for rendering thread names.
Definition at line 198 of file HubDevice.hxx.
|
protected |
If this is 1, we have already enqueued the request to exit the write flow.
Definition at line 210 of file HubDevice.hxx.
|
protected |
Service for the write flow.
Definition at line 202 of file HubDevice.hxx.
|
protected |
This executor is running the writes.
Definition at line 200 of file HubDevice.hxx.