Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sched/semaphore: tick wait 0 timeout should be safe in interrupt context #15377

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sched/semaphore/sem_tickwait.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@

int nxsem_tickwait(FAR sem_t *sem, uint32_t delay)
{
FAR struct tcb_s *rtcb = this_task();
FAR struct tcb_s *rtcb;
irqstate_t flags;
int ret;

DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
xiaoxiang781216 marked this conversation as resolved.
Show resolved Hide resolved

/* We will disable interrupts until we have completed the semaphore
* wait. We need to do this (as opposed to just disabling pre-emption)
* because there could be interrupt handlers that are asynchronously
Expand Down Expand Up @@ -106,6 +104,8 @@ int nxsem_tickwait(FAR sem_t *sem, uint32_t delay)
goto out;
}

rtcb = this_task();

/* Start the watchdog with interrupts still disabled */

wd_start(&rtcb->waitdog, delay, nxsem_timeout, (uintptr_t)rtcb);
Expand Down
Loading