Skip to content

Commit

Permalink
sem: remove the additional assignment.
Browse files Browse the repository at this point in the history
reason:
running tcb->waitobj should be NULL

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 authored and xiaoxiang781216 committed Dec 12, 2024
1 parent f66c4a0 commit f301524
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions sched/semaphore/sem_trywait.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@

static int nxsem_trywait_slow(FAR sem_t *sem)
{
FAR struct tcb_s *rtcb;
irqstate_t flags;
int32_t semcount;
int ret;
Expand All @@ -72,7 +71,6 @@ static int nxsem_trywait_slow(FAR sem_t *sem)
*/

flags = enter_critical_section();
rtcb = this_task();

/* If the semaphore is available, give it to the requesting task */

Expand All @@ -99,7 +97,6 @@ static int nxsem_trywait_slow(FAR sem_t *sem)
}

nxsem_add_holder(sem);
rtcb->waitobj = NULL;

/* Interrupts may now be enabled. */

Expand Down
4 changes: 2 additions & 2 deletions sched/semaphore/sem_wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

static int nxsem_wait_slow(FAR sem_t *sem)
{
FAR struct tcb_s *rtcb = this_task();
FAR struct tcb_s *rtcb;
irqstate_t flags;
int ret;

Expand Down Expand Up @@ -98,7 +98,6 @@ static int nxsem_wait_slow(FAR sem_t *sem)
}

nxsem_add_holder(sem);
rtcb->waitobj = NULL;
}

/* The semaphore is NOT available, We will have to block the
Expand All @@ -110,6 +109,7 @@ static int nxsem_wait_slow(FAR sem_t *sem)
#ifdef CONFIG_PRIORITY_INHERITANCE
uint8_t prioinherit = sem->flags & SEM_PRIO_MASK;
#endif
rtcb = this_task();

/* First, verify that the task is not already waiting on a
* semaphore
Expand Down

0 comments on commit f301524

Please sign in to comment.