Miosix
2.0alpha1
|
#include <queue.h>
Public Member Functions | |
Queue () | |
bool | isEmpty () const |
bool | isFull () const |
unsigned int | size () const |
unsigned int | capacity () const |
void | waitUntilNotEmpty () |
void | waitUntilNotFull () |
void | get (T &elem) |
void | put (const T &elem) |
bool | IRQget (T &elem) |
bool | IRQget (T &elem, bool &hppw) |
bool | IRQput (const T &elem) |
bool | IRQput (const T &elem, bool &hppw) |
void | reset () |
void | IRQreset () |
A queue, used to transfer data between TWO threads, or between ONE thread and an IRQ.
If you need to tranfer data between more than two threads, you need to use mutexes to ensure that only one thread at a time calls get, and only one thread at a time calls put.
Dynamically creating a queue with new or on the stack must be done with care, to avoid deleting a queue with a waiting thread, and to avoid situations where a thread tries to access a deleted queue.
T | the type of elements in the queue |
len | the length of the Queue. Value 0 is forbidden |
|
inline |
Constructor, create a new empty queue.
|
inline |
|
inline |
Same as reset(), but to be used only inside IRQs or when interrupts are disabled.
|
inline |
|
inline |
|
inline |
Clear all items in the queue.
Cannot be used inside an IRQ
|
inline |