#include <epicsMessageQueue.h>
|
| | epicsMessageQueue (unsigned int capacity, unsigned int maximumMessageSize) |
| | Constructor. More...
|
| |
|
| ~epicsMessageQueue () |
| | Destructor.
|
| |
| int | trySend (void *message, unsigned int messageSize) |
| | Try to send a message. More...
|
| |
| int | send (void *message, unsigned int messageSize) |
| | Send a message. More...
|
| |
| int | send (void *message, unsigned int messageSize, double timeout) |
| | Send a message or timeout. More...
|
| |
| int | tryReceive (void *message, unsigned int size) |
| | Try to receive a message. If the queue holds at least one message, the first message on the queue is moved to the specified location and the length of that message is returned. More...
|
| |
| int | receive (void *message, unsigned int size) |
| | Fetch the next message on the queue. Wait for a message to be sent if the queue is empty, then move the first message queued to the specified location. More...
|
| |
| int | receive (void *message, unsigned int size, double timeout) |
| | Wait for a message to be queued. Wait up to timeout seconds for a message to be sent if the queue is empty, then move the first message to the specified location. More...
|
| |
| void | show (unsigned int level=0) |
| | Displays some information about the message queue. More...
|
| |
| unsigned int | pending () |
| | How many messages are queued. More...
|
| |
Provides methods for sending messages between threads on a first in, first out basis. It is designed so that a single message queue can be used with multiple writer and reader threads.
A C++ epicsMessageQueue cannot be assigned to, copy-constructed, or constructed without giving the capacity and max-imumMessageSize arguments.
The C++ compiler will object to some of the statements below:
Definition at line 48 of file epicsMessageQueue.h.
◆ epicsMessageQueue()
| epicsMessageQueue::epicsMessageQueue |
( |
unsigned int |
capacity, |
|
|
unsigned int |
maximumMessageSize |
|
) |
| |
- Parameters
-
| capacity | Maximum number of messages to queue |
| maximumMessageSize | Number of bytes of the largest message that may be queued |
◆ trySend()
| int epicsMessageQueue::trySend |
( |
void * |
message, |
|
|
unsigned int |
messageSize |
|
) |
| |
- Note
- On VxWorks and RTEMS this method may be called from an interrupt handler.
- Returns
- 0 if the message was sent to a receiver or queued for future delivery.
-
-1 if no more messages can be queued or if the message is larger than the queue's maximum message size.
◆ send() [1/2]
| int epicsMessageQueue::send |
( |
void * |
message, |
|
|
unsigned int |
messageSize |
|
) |
| |
- Returns
- 0 if the message was sent to a receiver or queued for future delivery.
-
-1 if the message is larger than the queue's maximum message size.
◆ send() [2/2]
| int epicsMessageQueue::send |
( |
void * |
message, |
|
|
unsigned int |
messageSize, |
|
|
double |
timeout |
|
) |
| |
- Returns
- 0 if the message was sent to a receiver or queued for future delivery.
-
-1 if the timeout was reached before the message could be sent or queued, or if the message is larger than the queue's maximum message size.
◆ tryReceive()
| int epicsMessageQueue::tryReceive |
( |
void * |
message, |
|
|
unsigned int |
size |
|
) |
| |
If the received message is larger than the specified message size the implementation may either return -1, or truncate the message. It is most efficient if the messageBufferSize is equal to the maximumMessageSize with which the message queue was created.
- Returns
- Number of bytes in the message.
-
-1 if the message queue is empty, or the buffer too small.
◆ receive() [1/2]
| int epicsMessageQueue::receive |
( |
void * |
message, |
|
|
unsigned int |
size |
|
) |
| |
If the received message is larger than the specified message size the implementation may either return -1, or truncate the message. It is most efficient if the messageBufferSize is equal to the maximumMessageSize with which the message queue was created.
- Returns
- Number of bytes in the message.
-
-1 if the buffer is too small for the message.
◆ receive() [2/2]
| int epicsMessageQueue::receive |
( |
void * |
message, |
|
|
unsigned int |
size, |
|
|
double |
timeout |
|
) |
| |
If the received message is larger than the specified messageBufferSize it may either return -1, or truncate the message. It is most efficient if the messageBufferSize is equal to the maximumMessageSize with which the message queue was created.
- Returns
- Number of bytes in the message.
-
-1 if a message is not received within the timeout interval.
◆ show()
| void epicsMessageQueue::show |
( |
unsigned int |
level = 0 | ) |
|
- Parameters
-
| level | Controls the amount of information displayed. |
◆ pending()
| unsigned int epicsMessageQueue::pending |
( |
| ) |
|
- Returns
- The number of messages presently in the queue.
The documentation for this class was generated from the following file: