Skip to content

Commit a2a0f39

Browse files
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
1 parent c98d947 commit a2a0f39

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Os/Generic/PriorityQueue.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ struct PriorityQueueHandle : public QueueHandle {
4747
};
4848
//! \brief generic priority queue implementation
4949
//!
50+
//! \warning This Priority Queue is not ISR safe
51+
//!
5052
//! A generic implementation of a priority queue to support the Os::QueueInterface. This queue uses OSAL mutexes,
5153
//! and condition variables to provide for a task-safe blocking queue implementation. Data is stored in heap memory.
5254
//!
@@ -88,6 +90,7 @@ class PriorityQueue : public Os::QueueInterface {
8890
//!
8991
//! \warning It is invalid to send a null buffer
9092
//! \warning This method will block if the queue is full and blockType is set to BLOCKING
93+
//! \warning This method is not ISR safe
9194
//!
9295
//! \param buffer: message data
9396
//! \param size: size of message data
@@ -124,6 +127,8 @@ class PriorityQueue : public Os::QueueInterface {
124127

125128
//! \brief get maximum messages stored at any given time
126129
//!
130+
//! \warning This method is not ISR safe
131+
//!
127132
//! Returns the maximum number of messages in this queue at any given time. This is the high-water mark for this
128133
//! queue.
129134
//! \return queue message high-water mark

Os/Generic/docs/sdd.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Os::PriorityQueue is an in-memory implementation of Os::Queue. It allows project
1212

1313
For memory protection, Os::PriorityQueue delegates to Os::Mutex and Os::ConditionVariable.
1414

15+
> [!WARNING]
16+
> 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.
17+
1518
### Os::PriorityQueue Key Algorithms
1619

1720
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.

0 commit comments

Comments
 (0)