Skip to content

semaphore requirement additions / enhancements#150

Open
nashif wants to merge 2 commits into
zephyrproject-rtos:mainfrom
nashif:topic/req/semaphore_001
Open

semaphore requirement additions / enhancements#150
nashif wants to merge 2 commits into
zephyrproject-rtos:mainfrom
nashif:topic/req/semaphore_001

Conversation

@nashif

@nashif nashif commented Jun 25, 2026

Copy link
Copy Markdown
Member
  • requirements: correct Semaphore reset error semantics
  • requirements: add Semaphore give-at-max and ISR usage requirements

nashif added 2 commits June 25, 2026 19:34
ZEP-SRS-5-17 stated that resetting a semaphore aborts acquisitions
"returning a resource contention error code". Per the k_sem_reset
behavior, pending take operations are aborted with the same error used
for a wait timeout (-EAGAIN), not a contention/busy code (-EBUSY, which
is used for the no-wait case in ZEP-SRS-5-11). Reword the requirement to
abort pending take operations and return the timeout error, consistent
with ZEP-SRS-5-10.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Audit against the k_sem API found two behaviors without a requirement:

- ZEP-SRS-5-19: k_sem_give does not increment the count beyond the
  maximum permitted count; add a requirement that releasing a semaphore
  already at its maximum leaves the count unchanged.
- ZEP-SRS-5-20: k_sem_give and k_sem_take (with no wait) are usable from
  interrupt context; add a requirement allowing release from an ISR and
  acquisition from an ISR when no waiting is requested.

The requirements reflect the implemented k_sem behavior following the
Route 3s approach and link to the Counting Semaphore system parent
(ZEP-SYRS-14).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
@kestewart
kestewart requested a review from tobiaskaestner July 8, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant