Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
MessageReceiver Class ReferenceSpawns a thread for monitoring a MessageQueue, calls a specified function when new messages are available. More...
Inheritance diagram for MessageReceiver:
Detailed DescriptionSpawns a thread for monitoring a MessageQueue, calls a specified function when new messages are available. Uses a semaphore which is raised by the MessageQueue itself when a new message is posted. This should have almost no overhead, and fairly low latency (at least, much lower latency than you would get by running multiple busy loops polling for new messages) Keep in mind that the monitor runs in a separate thread, so you will need to consider mutex issues when the callback is executing. Definition at line 19 of file MessageReceiver.h.
Member Typedef Documentation
shorthand for the message id type Definition at line 47 of file MessageReceiver.h. Constructor & Destructor Documentation
constructor, indicate the message queue, and optional callback function and whether to start the monitor right away
Definition at line 9 of file MessageReceiver.cc.
destructor, stops and joins thread Definition at line 23 of file MessageReceiver.cc.
don't call Member Function Documentation
sets curit to the oldest message which hasn't been marked read Definition at line 56 of file MessageReceiver.cc. Referenced by getNextMessage(), markRead(), and peekNextMessage().
thread control -- stop(), join(), and process any final messages in the queue; unsubscribes as a listener of the MessageQueue Definition at line 68 of file MessageReceiver.cc. Referenced by MotionManager::RemoveAccess().
returns the next unread message, marking it as read. Caller inherits reference, and should call removeReference when done. Definition at line 40 of file MessageReceiver.cc.
register as a listener with the queue, if we haven't already (retains listener status between stop/start) Reimplemented from Thread. Definition at line 81 of file MessageReceiver.cc.
if checksNext is set, raises semid so that if additional messages came in while we were processing the current one, they will be picked up Definition at line 127 of file MessageReceiver.cc.
marks the current message as read, and allows MessageQueue to process next unread message Definition at line 36 of file MessageReceiver.h. Referenced by markRead(), and processNextMessage().
don't call
returns the next unread message without marking it read, or NULL if there are currently no more messages. MessageReceiver retains reference. Definition at line 32 of file MessageReceiver.cc. Referenced by processNextMessage().
gets the next message and processes it Definition at line 106 of file MessageReceiver.cc.
wait for a new message, and then process it Reimplemented from Thread. Definition at line 91 of file MessageReceiver.cc.
allows you to change the callback function -- should be set before the thread is started (otherwise, why bother starting it?) Definition at line 44 of file MessageReceiver.h.
thread control -- stop monitoring (can call start() later to resume) Reimplemented from Thread. Definition at line 50 of file MessageReceiver.cc. Referenced by finish(), and ~MessageReceiver().
wait for semid to be raised to indicate a new message is in the queue (or at least, that it needs to be checked); returns false if interrupted Definition at line 102 of file MessageReceiver.cc. Referenced by runloop(). Member Data Documentation
the message id of the last received message (currently being processed) Definition at line 61 of file MessageReceiver.h. Referenced by findCurrentMessage(), getNextMessage(), markRead(), peekNextMessage(), and processNextMessage().
the serial number of the last received message Definition at line 59 of file MessageReceiver.h. Referenced by processNextMessage().
the expected serial number of the next message to be sent Definition at line 58 of file MessageReceiver.h. Referenced by findCurrentMessage(), getNextMessage(), and markRead().
the client callback function Definition at line 60 of file MessageReceiver.h. Referenced by processNextMessage(), and setCallback().
the MessageQueue being monitored Definition at line 56 of file MessageReceiver.h. Referenced by findCurrentMessage(), finish(), getNextMessage(), launched(), markRead(), MessageReceiver(), peekNextMessage(), processNextMessage(), runloop(), stop(), waitNextMessage(), and ~MessageReceiver().
the semaphore raised when the queue should be checked for new messages Definition at line 57 of file MessageReceiver.h. Referenced by finish(), getNextMessage(), launched(), markRead(), MessageReceiver(), runloop(), stop(), waitNextMessage(), and ~MessageReceiver(). The documentation for this class was generated from the following files: |
Tekkotsu v5.1CVS |
Generated Mon May 9 04:59:13 2016 by Doxygen 1.6.3 |