Stacks
SPDX-License-Identifier: Apache-2.0
The Zephyr RTOS shall provide a mechanism to define and initialize a stack at compile time.
The Zephyr RTOS shall provide a mechanism to initialize a stack at run time, using a data buffer provided by the user.
The Zephyr RTOS shall provide a mechanism to initialize a stack at run time, with automatic allocation of the stack memory.
The Zephyr RTOS shall provide a mechanism to deallocate all resources previously allocated by a run-time stack definition.
The Zephyr RTOS shall provide a mechanism to add a new item on top of the stack.
The Zephyr RTOS shall provide a mechanism to retrieve the current item from the top of the stack and to remove such item from the stack.
If the stack is full when an item is pushed, the Zephyr RTOS shall return an error and not add the item.
The Zephyr RTOS shall provide a mechanism to push items to or pop items from the same stack object from multiple execution contexts which can run concurrently.
As a Zephyr RTOS user I want to access a stack from different execution contexts (like threads), including interrupt handlers.
The Zephyr RTOS shall provide a mechanism to allow waiting for a stack item availability within a specified timeout.
As a Zephyr RTOS user I want to share a stack object between a producer and a consumer threads. The producer thread pushes items into the stack, while the consumer thread is waiting for an item to appear in the stack.
When no item becomes available on a stack within the specified time, the Zephyr RTOS shall return an error indicating that no item was retrieved.