mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 13:52:22 +08:00
sched/wqueue: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in the sched wqueue module with
spin_lock_irqsave_nopreempt() to improve code clarity and consistency.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
This commit is contained in:
committed by
Xiang Xiao
parent
a49a5fd27f
commit
a04f257d4b
@@ -360,8 +360,7 @@ void work_notifier_signal(enum work_evtype_e evtype,
|
||||
* the notifications have been sent.
|
||||
*/
|
||||
|
||||
flags = spin_lock_irqsave(&g_notifier_lock);
|
||||
sched_lock();
|
||||
flags = spin_lock_irqsave_nopreempt(&g_notifier_lock);
|
||||
|
||||
/* Process the notification at the head of the pending list until the
|
||||
* pending list is empty
|
||||
@@ -404,8 +403,7 @@ void work_notifier_signal(enum work_evtype_e evtype,
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&g_notifier_lock, flags);
|
||||
sched_unlock();
|
||||
spin_unlock_irqrestore_nopreempt(&g_notifier_lock, flags);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WQUEUE_NOTIFIER */
|
||||
|
||||
@@ -211,8 +211,7 @@ static int work_thread(int argc, FAR char *argv[])
|
||||
* so ourselves, and (2) there will be no changes to the work queue
|
||||
*/
|
||||
|
||||
flags = spin_lock_irqsave(&wqueue->lock);
|
||||
sched_lock();
|
||||
flags = spin_lock_irqsave_nopreempt(&wqueue->lock);
|
||||
|
||||
/* If the wqueue timer is expired and non-active, it indicates that
|
||||
* there might be expired work in the pending queue.
|
||||
@@ -247,16 +246,14 @@ static int work_thread(int argc, FAR char *argv[])
|
||||
|
||||
kworker->work = work;
|
||||
|
||||
spin_unlock_irqrestore(&wqueue->lock, flags);
|
||||
sched_unlock();
|
||||
spin_unlock_irqrestore_nopreempt(&wqueue->lock, flags);
|
||||
|
||||
/* Do the work. Re-enable interrupts while the work is being
|
||||
* performed... we don't have any idea how long this will take!
|
||||
*/
|
||||
|
||||
CALL_WORKER(worker, arg);
|
||||
flags = spin_lock_irqsave(&wqueue->lock);
|
||||
sched_lock();
|
||||
flags = spin_lock_irqsave_nopreempt(&wqueue->lock);
|
||||
|
||||
/* Mark the thread un-busy */
|
||||
|
||||
@@ -271,8 +268,7 @@ static int work_thread(int argc, FAR char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&wqueue->lock, flags);
|
||||
sched_unlock();
|
||||
spin_unlock_irqrestore_nopreempt(&wqueue->lock, flags);
|
||||
|
||||
/* Wait for the semaphore to be posted by the wqueue timer. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user