PriorityQueue Send mark as unsafe for ISR (#3216)

* Updated comment to indicate functions are not ISR safe since they use a mutex under the hood

* added another needed comment

* Adding warning on priorityqueue usage within an ISR
This commit is contained in:
kevin-f-ortega 2025-02-12 15:32:54 -08:00 committed by GitHub
parent c98d947543
commit a2a0f39e99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,8 @@ struct PriorityQueueHandle : public QueueHandle {
};
//! \brief generic priority queue implementation
//!
//! \warning This Priority Queue is not ISR safe
//!
//! A generic implementation of a priority queue to support the Os::QueueInterface. This queue uses OSAL mutexes,
//! and condition variables to provide for a task-safe blocking queue implementation. Data is stored in heap memory.
//!
@ -88,6 +90,7 @@ class PriorityQueue : public Os::QueueInterface {
//!
//! \warning It is invalid to send a null buffer
//! \warning This method will block if the queue is full and blockType is set to BLOCKING
//! \warning This method is not ISR safe
//!
//! \param buffer: message data
//! \param size: size of message data
@ -124,6 +127,8 @@ class PriorityQueue : public Os::QueueInterface {
//! \brief get maximum messages stored at any given time
//!
//! \warning This method is not ISR safe
//!
//! Returns the maximum number of messages in this queue at any given time. This is the high-water mark for this
//! queue.
//! \return queue message high-water mark

View File

@ -12,6 +12,9 @@ Os::PriorityQueue is an in-memory implementation of Os::Queue. It allows project
For memory protection, Os::PriorityQueue delegates to Os::Mutex and Os::ConditionVariable.
> [!WARNING]
> This Queue implementation is insufficient to be used for sending messages in ISR context due to the use of Os::Mutex as mentioned in above.
### Os::PriorityQueue Key Algorithms
Os::PriorityQueue stores messages in a set of dynamically allocated unordered parallel arrays. These arrays store: message data, and message data size respectively. There is also an index-free list that stores the indices that are available for storage in the fixed size arrays.