|
void | update (unsigned char flag=0xff) |
| Notify service thread that a port has been added or removed, or a timer changed, so that a new schedule can be computed for expiring attached ports.
|
|
| SerialService (int pri=0, size_t stack=0, const char *id=NULL) |
| Create a service thread for attaching serial ports.
|
|
virtual | ~SerialService () |
| Terminate the service thread and update attached objects.
|
|
int | getCount (void) |
| Get current reference count.
|
|
| Thread (bool isMain) |
| This is actually a special constructor that is used to create a thread "object" for the current execution context when that context is not created via an instance of a derived Thread object itself.
|
|
| Thread (int pri=0, size_t stack=0) |
| When a thread object is contructed, a new thread of execution context is created.
|
|
| Thread (const Thread &th) |
| A thread of execution can also be specified by cloning an existing thread.
|
|
virtual | ~Thread () |
| The thread destructor should clear up any resources that have been allocated by the thread.
|
|
int | start (Semaphore *start=0) |
| When a new thread is created, it does not begin immediate execution.
|
|
int | detach (Semaphore *start=0) |
| Start a new thread as "detached".
|
|
Thread * | getParent (void) |
| Gets the pointer to the Thread class which created the current thread object.
|
|
void | suspend (void) |
| Suspends execution of the selected thread.
|
|
void | resume (void) |
| Resumes execution of the selected thread.
|
|
Cancel | getCancel (void) |
| Used to retrieve the cancellation mode in effect for the selected thread.
|
|
bool | isRunning (void) const |
| Verifies if the thread is still running or has already been terminated but not yet deleted.
|
|
bool | isDetached (void) const |
| Check if this thread is detached.
|
|
void | join (void) |
| Blocking call which unlocks when thread terminates.
|
|
bool | isThread (void) const |
| Tests to see if the current execution context is the same as the specified thread object.
|
|
cctid_t | getId (void) const |
| Get system thread numeric identifier.
|
|
const char * | getName (void) const |
| Get the name string for this thread, to use in debug messages.
|
|
|
virtual void | onUpdate (unsigned char flag) |
| A virtual handler for processing user defined update requests (1-254) which have been posted through Update.
|
|
virtual void | onEvent (void) |
| A virtual handler for event loop calls.
|
|
virtual void | onCallback (SerialPort *port) |
| A virtual handler for adding support for additional callback events into SerialPort.
|
|
void | setName (const char *text) |
| Set the name of the current thread.
|
|
virtual void | run (void)=0 |
| All threads execute by deriving the Run method of Thread.
|
|
virtual void | final (void) |
| A thread that is self terminating, either by invoking exit() or leaving it's run(), will have this method called.
|
|
virtual void | initial (void) |
| The initial method is called by a newly created thread when it starts execution.
|
|
virtual void * | getExtended (void) |
| Since getParent() and getThread() only refer to an object of the Thread "base" type, this virtual method can be replaced in a derived class with something that returns data specific to the derived class that can still be accessed through the pointer returned by getParent() and getThread().
|
|
virtual void | notify (Thread *) |
| When a thread terminates, it now sends a notification message to the parent thread which created it.
|
|
void | exit (void) |
| Used to properly exit from a Thread derived run() or initial() method.
|
|
void | sync (void) |
| Used to wait for a join or cancel, in place of explicit exit.
|
|
bool | testCancel (void) |
| test a cancellation point for deferred thread cancellation.
|
|
void | setCancel (Cancel mode) |
| Sets thread cancellation mode.
|
|
void | setSuspend (Suspend mode) |
| Sets the thread's ability to be suspended from execution.
|
|
void | terminate (void) |
| Used by another thread to terminate the current thread.
|
|
void | clrParent (void) |
| clear parent thread relationship.
|
|
The SerialService is a thead service object that is meant to service attached serial ports.
Multiple pool objects may be created and multiple serial ports may be attached to the same thread of of execution. This allows one to balance threads and the serial ports they service.
The TTYPort and TTYService classes are used to form thread-pool serviced serial I/O protocol sets. These can be used when one has a large number of serial devices to manage, and a single (or limited number of) thread(s) can then be used to service the tty port objects present. Each tty port supports a timer control and several virtual methods that the service thread can call when events occur. This model provides for "callback" event management, whereby the service thread performs a "callback" into the port object when events occur. Specific events supported include the expiration of a TTYPort timer, pending input data waiting to be read, and "sighup" connection breaks.
- Author
- David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m
Thread pool service for serial ports.