This class provides a simple, thread safe FIFO message queue. More...
#include <message_queue.h>
Public Member Functions | |
MessageQueue () | |
Construct a message queue. | |
C | read () |
int | size () |
void | write (const C &message) |
~MessageQueue () | |
Destruct a message queue. | |
Private Attributes | |
sem_t | empty_slots |
std::deque< C > | queue |
Synchronized | queue_mutex |
This class provides a simple, thread safe FIFO message queue.
Definition at line 12 of file message_queue.h.
CVD::MessageQueue< C >::MessageQueue | ( | ) | [inline] |
Construct a message queue.
Definition at line 16 of file message_queue.h.
CVD::MessageQueue< C >::~MessageQueue | ( | ) | [inline] |
Destruct a message queue.
Definition at line 22 of file message_queue.h.
C CVD::MessageQueue< C >::read | ( | ) | [inline] |
Read a message from the queue. Wait if the queue is empty.
Definition at line 42 of file message_queue.h.
int CVD::MessageQueue< C >::size | ( | ) | [inline] |
Definition at line 55 of file message_queue.h.
void CVD::MessageQueue< C >::write | ( | const C & | message | ) | [inline] |
Write a message to the queue.
message | The message to write to the queue |
Definition at line 29 of file message_queue.h.
sem_t CVD::MessageQueue< C >::empty_slots [private] |
Definition at line 65 of file message_queue.h.
std::deque<C> CVD::MessageQueue< C >::queue [private] |
Definition at line 64 of file message_queue.h.
Synchronized CVD::MessageQueue< C >::queue_mutex [private] |
Definition at line 63 of file message_queue.h.