CppELib 1.7.0
|
Class template of message queue. More...
#include <MessageQueue.h>
Public Member Functions | |
Error | send (const T &msg) |
Send the message. | |
Error | trySend (const T &msg) |
Send the message without blocking. | |
Error | timedSend (const T &msg, Timeout tmout) |
Send the message within the limited time. | |
Error | receive (T *msg) |
Receive the message. | |
Error | tryReceive (T *msg) |
Receive the message without blocking. | |
Error | timedReceive (T *msg, Timeout tmout) |
Receive the message within the limited time. | |
std::size_t | getSize () const |
Get the queue size. | |
std::size_t | getMaxSize () const |
Get the max queue size. | |
Static Public Member Functions | |
static MessageQueue * | create (std::size_t maxSize) |
Create a MessageQueue object. | |
static void | destroy (MessageQueue *m) |
Destroy a MessageQueue object. | |
Class template of message queue.
T | Type of element |
|
inlinestatic |
Create a MessageQueue object.
maxSize | Max queue size |
|
inlinestatic |
Destroy a MessageQueue object.
m | Pointer of MessageQueue object created by MessageQueue<T>::create() |
|
inline |
Get the max queue size.
|
inline |
Get the queue size.
|
inline |
Receive the message.
This method dequeues the message from this queue. If this queue is empty, block the current thread until to be enqueued by send methods.
msg | Pointer of variable that stores the message received. If null pointer, not accessed |
OK | Success. The message was received |
CalledByNonThread | Called from non thread context (interrupt handler, timer, etc) |
|
inline |
Send the message.
This method enqueues the message into this queue. If this queue is full, block the current thread until to be dequeued by receive methods.
msg | Message to send |
OK | Success. The message was sent |
CalledByNonThread | Called from non thread context (interrupt handler, timer, etc) |
|
inline |
Receive the message within the limited time.
This method dequeues the message from this queue. If this queue is empty, block the current thread until to be enqueued by send methods but only within the limited time.
msg | Pointer of variable that stores the message received. If null pointer, not accessed |
tmout | The limited time |
OK | Success. The message was received |
TimedOut | The limited time was elapsed |
CalledByNonThread | Called from non thread context (interrupt handler, timer, etc) |
|
inline |
Send the message within the limited time.
This method enqueues the message into this queue. If this queue is full, block the current thread until to be dequeued by receive methods but only within the limited time.
msg | Message to send |
tmout | The limited time |
OK | Success. The message was sent |
TimedOut | The limited time was elapsed |
CalledByNonThread | Called from non thread context (interrupt handler, timer, etc) |
|
inline |
Receive the message without blocking.
This method dequeues the message from this queue. If this queue is empty, returns TimedOut immediately.
msg | Pointer of variable that stores the message received. If null pointer, not accessed |
OK | Success. The message was received |
TimedOut | This queue is empty |
|
inline |
Send the message without blocking.
This method enqueues the message into this queue. If this queue is full, returns TimedOut immediately.
msg | Message to send |
OK | Success. The message was sent |
TimedOut | This queue is full |