Mutex
|
Type
|
Level
|
UID
|
STATUS
|
TYPE
|
COMPONENT
|
REFS
|
Title
|
Statement
|
USER_STORY
|
|---|---|---|---|---|---|---|---|---|---|
|
TEXT
|
|
|
SPDX-License-Identifier: Apache-2.0 |
||||||
|
REQUIREMENT
|
1 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide a mutex that allows threads to obtain mutually exclusive access to a shared resource. |
As a Zephyr RTOS user I want to be able to synchronize threads when accessing common resources, where the thread shall have the option to: - wait indefinitely until the resource becomes available. - immediately return with an error if the resource is not available and continue. - wait for a given time for the resource to become available or return with an error. |
|
REQUIREMENT
|
2 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide a mechanism to define and initialize a mutex at compile time. |
|
|
REQUIREMENT
|
3 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide a mechanism to initialize a mutex at run time. |
|
|
REQUIREMENT
|
4 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide a mechanism for a thread to lock a mutex and become its owner. |
|
|
REQUIREMENT
|
5 |
|
|
|
|
Parents:
|
|
While a mutex is not owned by any thread, a thread that locks it shall acquire ownership of the mutex. |
|
|
REQUIREMENT
|
6 |
|
|
|
|
Parents:
|
|
While a mutex is owned by another thread, a thread that attempts to lock it shall be blocked until the mutex becomes available or the specified timeout elapses. |
|
|
REQUIREMENT
|
7 |
|
|
|
|
Parents:
|
|
When locking a mutex, the Zephyr RTOS shall accept a timeout that specifies the maximum time to wait for the mutex to become available. |
|
|
REQUIREMENT
|
8 |
|
|
|
|
Parents:
|
|
When a mutex does not become available within the specified time, the Zephyr RTOS shall return an error indicating that the mutex was not locked. |
|
|
REQUIREMENT
|
9 |
|
|
|
|
Parents:
|
|
While a thread owns a mutex, the Zephyr RTOS shall allow that thread to lock the same mutex again, and shall require the thread to unlock it the same number of times before it is released. |
|
|
REQUIREMENT
|
10 |
|
|
|
|
Parents:
|
|
The Zephyr RTOS shall provide a mechanism for the owning thread to unlock a mutex. |
|
|
REQUIREMENT
|
11 |
|
|
|
|
Parents:
|
|
If a thread that does not own a mutex attempts to unlock it, then the Zephyr RTOS shall return an error and shall not release the mutex. |
|
|
REQUIREMENT
|
12 |
|
|
|
|
Parents:
|
|
While a higher-priority thread is blocked waiting on a mutex, the Zephyr RTOS shall raise the priority of the owning thread to that of the highest-priority waiting thread until the mutex is released. |
|