Skip to content

Commit

Permalink
sched: Use spinlock repalce sched_[un]lock in some place
Browse files Browse the repository at this point in the history
Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Oct 16, 2024
1 parent c7455e7 commit e1a31d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions sched/signal/sig_findaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
FAR sigactq_t *nxsig_find_action(FAR struct task_group_s *group, int signo)
{
FAR sigactq_t *sigact = NULL;
irqstate_t flags;

/* Verify the caller's sanity */

Expand All @@ -54,15 +55,15 @@ FAR sigactq_t *nxsig_find_action(FAR struct task_group_s *group, int signo)
* protection.
*/

sched_lock();
flags = spin_lock_irqsave(NULL);

/* Search the list for a sigaction on this signal */

for (sigact = (FAR sigactq_t *)group->tg_sigactionq.head;
((sigact) && (sigact->signo != signo));
sigact = sigact->flink);

sched_unlock();
spin_unlock_irqrestore(NULL, flags);
}

return sigact;
Expand Down
5 changes: 3 additions & 2 deletions sched/task/task_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ static int nxthread_setup_scheduler(FAR struct tcb_s *tcb, int priority,
uint8_t ttype)
{
FAR struct tcb_s *rtcb = this_task();
irqstate_t flags;
int ret;

/* Assign a unique task ID to the task. */
Expand Down Expand Up @@ -481,10 +482,10 @@ static int nxthread_setup_scheduler(FAR struct tcb_s *tcb, int priority,

/* Add the task to the inactive task list */

sched_lock();
flags = spin_lock_irqsave(NULL);
dq_addfirst((FAR dq_entry_t *)tcb, list_inactivetasks());
tcb->task_state = TSTATE_TASK_INACTIVE;
sched_unlock();
spin_unlock_irqrestore(NULL, flags);
}

return ret;
Expand Down

0 comments on commit e1a31d9

Please sign in to comment.