]> begriffs open source - freertos/commit
Add a cap to the queue locks (#435)
authorGaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Thu, 6 Jan 2022 05:14:01 +0000 (21:14 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Jan 2022 05:14:01 +0000 (21:14 -0800)
commitbecbb89181df9f76ddfee8ed67997dfe04f17e05
tree6968356f8a773a11b1ba1476adbd3e14b969d087
parent8e2dd5b861fd15a73ec85521470aa9709c668e1e
Add a cap to the queue locks (#435)

Add a cap to the queue locks

cRxLock and cTxLock members of the queue data structure count the
number items received and sent to the queue while the queue was locked.
These are later used to unblock tasks waiting on the queue when the
queue is unlocked. The data type of these members is int8_t and this can
trigger overflow check assert if an ISR continuously reads/writes to the
queue in a loop as reported in this issue: https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/419.

Note due to the length of the operation is it not recommended to write to
the queue that many times from an ISR - stream buffers are a better option,
or alternatively, defer the operation to a task by just having the ISR send a
direct to task notification to unblock the task.

This PR caps the values of the cRxLock and cTxLock to the number of tasks in
the system because we cannot unblocks more tasks than there are in the system.
Note that the same assert could still be triggered is the application creates more
than 127 tasks.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
queue.c