Miosix  2.01
Syncronization

Classes

class  miosix::Queue< T, len >
 
class  miosix::DynUnsyncQueue< T >
 
class  miosix::BufferQueue< T, size, numbuf >
 
class  miosix::FastMutex
 
class  miosix::Mutex
 
class  miosix::Lock< T >
 
class  miosix::Unlock< T >
 
class  miosix::ConditionVariable
 
class  miosix::Timer
 

Enumerations

enum  miosix::FastMutex::Options { miosix::FastMutex::DEFAULT, miosix::FastMutex::RECURSIVE }
 
enum  miosix::Mutex::Options { miosix::Mutex::DEFAULT, miosix::Mutex::RECURSIVE }
 

Functions

void miosix::Queue< T, len >::waitUntilNotEmpty ()
 
void miosix::Queue< T, len >::waitUntilNotFull ()
 
void miosix::Queue< T, len >::get (T &elem)
 
void miosix::Queue< T, len >::put (const T &elem)
 
bool miosix::Queue< T, len >::IRQget (T &elem)
 
bool miosix::Queue< T, len >::IRQget (T &elem, bool &hppw)
 
bool miosix::Queue< T, len >::IRQput (const T &elem)
 
bool miosix::Queue< T, len >::IRQput (const T &elem, bool &hppw)
 
bool miosix::DynUnsyncQueue< T >::tryPut (const T &elem)
 
bool miosix::DynUnsyncQueue< T >::tryGet (T &elem)
 

Detailed Description

Miosix syncronization API

Miosix provides the Mutex class to guard critical sections,
the ConditionVariable class for thread synchronization,
the Queue class to transfer data between threads,
and the Timer class to measure time intervals.

Enumeration Type Documentation

Mutex options, passed to the constructor to set additional options.
The DEFAULT option indicates the default Mutex type.

Enumerator
DEFAULT 

Default mutex.

RECURSIVE 

Mutex is recursive.

Mutex options, passed to the constructor to set additional options.
The DEFAULT option indicates the default Mutex type.

Enumerator
DEFAULT 

Default mutex.

RECURSIVE 

Mutex is recursive.

Function Documentation

template<typename T , unsigned int len>
void miosix::Queue< T, len >::get ( T &  elem)

Get an element from the queue. If the queue is empty, then sleep until an element becomes available.

Parameters
eleman element from the queue
template<typename T , unsigned int len>
bool miosix::Queue< T, len >::IRQget ( T &  elem)

Get an element from the queue, only if the queue is not empty.
Can ONLY be used inside an IRQ, or when interrupts are disabled.

Parameters
eleman element from the queue. The element is valid only if the return value is true
Returns
true if the queue was not empty
template<typename T , unsigned int len>
bool miosix::Queue< T, len >::IRQget ( T &  elem,
bool &  hppw 
)

Get an element from the queue, only if the queue is not empty.
Can ONLY be used inside an IRQ, or when interrupts are disabled.

Parameters
eleman element from the queue. The element is valid only if the return value is true
hppwis not modified if no thread is woken or if the woken thread has a lower or equal priority than the currently running thread, else is set to true
Returns
true if the queue was not empty
template<typename T , unsigned int len>
bool miosix::Queue< T, len >::IRQput ( const T &  elem)

Put an element to the queue, only if th queue is not full.
Can ONLY be used inside an IRQ, or when interrupts are disabled.

Parameters
elemelement to add. The element has been added only if the return value is true
Returns
true if the queue was not full.
template<typename T , unsigned int len>
bool miosix::Queue< T, len >::IRQput ( const T &  elem,
bool &  hppw 
)

Put an element to the queue, only if th queue is not full.
Can ONLY be used inside an IRQ, or when interrupts are disabled.

Parameters
elemelement to add. The element has been added only if the return value is true
hppwis not modified if no thread is woken or if the woken thread has a lower or equal priority than the currently running thread, else is set to true
Returns
true if the queue was not full.
template<typename T , unsigned int len>
void miosix::Queue< T, len >::put ( const T &  elem)

Put an element to the queue. If the queue is full, then sleep until a place becomes available.

Parameters
elemelement to add to the queue
template<typename T >
bool miosix::DynUnsyncQueue< T >::tryGet ( T &  elem)

Try to get an element from the circular buffer

Parameters
elemelement to get will be stored here
Returns
true if the queue was not empty
template<typename T >
bool miosix::DynUnsyncQueue< T >::tryPut ( const T &  elem)

Try to put an element in the circular buffer

Parameters
elemelement to put
Returns
true if the queue was not full
template<typename T , unsigned int len>
void miosix::Queue< T, len >::waitUntilNotEmpty ( )

If a queue is empty, waits until the queue is not empty.

template<typename T , unsigned int len>
void miosix::Queue< T, len >::waitUntilNotFull ( )

If a queue is full, waits until the queue is not full