Zephyr Project Requirements
Mutex

Mutex

UID:
VERSION:
CLASSIFICATION:
PREFIX:
ZEP-SRS-6-
Type
Level
UID
STATUS
TYPE
COMPONENT
REFS
Title
Statement
USER_STORY
TEXT

SPDX-License-Identifier: Apache-2.0

REQUIREMENT
1
ZEP-SRS-6-1
Draft
Functional
Mutex
ZEP-SRS-6-1
Mutex Kernel Object

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
ZEP-SRS-6-2
Draft
Functional
Mutex
ZEP-SRS-6-2
Mutex definition at compile time

The Zephyr RTOS shall provide a mechanism to define and initialize a mutex at compile time.

REQUIREMENT
3
ZEP-SRS-6-3
Draft
Functional
Mutex
ZEP-SRS-6-3
Mutex definition at run time

The Zephyr RTOS shall provide a mechanism to initialize a mutex at run time.

REQUIREMENT
4
ZEP-SRS-6-4
Draft
Functional
Mutex
ZEP-SRS-6-4
Locking a mutex

The Zephyr RTOS shall provide a mechanism for a thread to lock a mutex and become its owner.

REQUIREMENT
5
ZEP-SRS-6-5
Draft
Functional
Mutex
ZEP-SRS-6-5
Locking an unowned mutex

While a mutex is not owned by any thread, a thread that locks it shall acquire ownership of the mutex.

REQUIREMENT
6
ZEP-SRS-6-6
Draft
Functional
Mutex
ZEP-SRS-6-6
Locking a mutex owned by another thread

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
ZEP-SRS-6-7
Draft
Functional
Mutex
ZEP-SRS-6-7
Mutex lock timeout

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
ZEP-SRS-6-8
Draft
Functional
Mutex
ZEP-SRS-6-8
Mutex lock timeout expiry

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
ZEP-SRS-6-9
Draft
Functional
Mutex
ZEP-SRS-6-9
Recursive mutex locking

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
ZEP-SRS-6-10
Draft
Functional
Mutex
ZEP-SRS-6-10
Unlocking a mutex

The Zephyr RTOS shall provide a mechanism for the owning thread to unlock a mutex.

REQUIREMENT
11
ZEP-SRS-6-11
Draft
Functional
Mutex
ZEP-SRS-6-11
Unlocking by a non-owner

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
ZEP-SRS-6-12
Draft
Functional
Mutex
ZEP-SRS-6-12
Priority inheritance

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.