Native QF Event Queue.
- Details
This class describes the native QF event queue, which can be used as the event queue for active objects, or as a simple "raw" event queue for thread-safe event passing among non-framework entities, such as ISRs, device drivers, or other third-party components.
The native QF event queue is configured by defining the macro QACTIVE_EQUEUE_TYPE as QEQueue in the specific QF port header file.
The QEQueue structure contains only data members for managing an event queue, but does not contain the storage for the queue buffer, which must be provided externally during the queue initialization.
The event queue can store only event pointers, not the whole events. The internal implementation uses the standard ring-buffer plus one external location that optimizes the queue operation for the most frequent case of empty queue.
The QEQueue structure is used with two sets of functions. One set is for the active object event queue, which might need to block the active object task when the event queue is empty and might need to unblock it when events are posted to the queue. The interface for the native active object event queue consists of the following functions: QActive_post(), QActive_postLIFO(), and QActive_get_(). Additionally the function QEQueue_initX() is used to initialize the queue.
The other set of functions, uses QEQueue as a simple "raw" event queue to pass events between entities other than active objects, such as ISRs. The "raw" event queue is not capable of blocking on the get() operation, but is still thread-safe because it uses QF critical section to protect its integrity. The interface for the "raw" thread-safe queue consists of the following functions: QEQueue_post(), QEQueue_postLIFO(), and QEQueue_get(). Additionally the function QEQueue_initX() is used to initialize the queue.
Most event queue operations (both the active object queues and the "raw" queues) internally use the QF critical section. You should be careful not to invoke those operations from other critical sections when nesting of critical sections is not supported.
- See also
- QEQueue for the description of the data members
Definition at line 49 of file qequeue.h.