sched: Use spinlock repalce sched_[un]lock in some place
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
8a1743d0a6
commit
a46eb84334
2 changed files with 6 additions and 4 deletions
|
|
@ -44,6 +44,7 @@
|
||||||
FAR sigactq_t *nxsig_find_action(FAR struct task_group_s *group, int signo)
|
FAR sigactq_t *nxsig_find_action(FAR struct task_group_s *group, int signo)
|
||||||
{
|
{
|
||||||
FAR sigactq_t *sigact = NULL;
|
FAR sigactq_t *sigact = NULL;
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
/* Verify the caller's sanity */
|
/* Verify the caller's sanity */
|
||||||
|
|
||||||
|
|
@ -54,7 +55,7 @@ FAR sigactq_t *nxsig_find_action(FAR struct task_group_s *group, int signo)
|
||||||
* protection.
|
* protection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sched_lock();
|
flags = spin_lock_irqsave(NULL);
|
||||||
|
|
||||||
/* Search the list for a sigaction on this signal */
|
/* Search the list for a sigaction on this signal */
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ FAR sigactq_t *nxsig_find_action(FAR struct task_group_s *group, int signo)
|
||||||
((sigact) && (sigact->signo != signo));
|
((sigact) && (sigact->signo != signo));
|
||||||
sigact = sigact->flink);
|
sigact = sigact->flink);
|
||||||
|
|
||||||
sched_unlock();
|
spin_unlock_irqrestore(NULL, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sigact;
|
return sigact;
|
||||||
|
|
|
||||||
|
|
@ -404,6 +404,7 @@ static int nxthread_setup_scheduler(FAR struct tcb_s *tcb, int priority,
|
||||||
uint8_t ttype)
|
uint8_t ttype)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = this_task();
|
FAR struct tcb_s *rtcb = this_task();
|
||||||
|
irqstate_t flags;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Assign a unique task ID to the task. */
|
/* Assign a unique task ID to the task. */
|
||||||
|
|
@ -481,10 +482,10 @@ static int nxthread_setup_scheduler(FAR struct tcb_s *tcb, int priority,
|
||||||
|
|
||||||
/* Add the task to the inactive task list */
|
/* Add the task to the inactive task list */
|
||||||
|
|
||||||
sched_lock();
|
flags = spin_lock_irqsave(NULL);
|
||||||
dq_addfirst((FAR dq_entry_t *)tcb, list_inactivetasks());
|
dq_addfirst((FAR dq_entry_t *)tcb, list_inactivetasks());
|
||||||
tcb->task_state = TSTATE_TASK_INACTIVE;
|
tcb->task_state = TSTATE_TASK_INACTIVE;
|
||||||
sched_unlock();
|
spin_unlock_irqrestore(NULL, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue