Revert "No need to call sched_lock explicitly after call spin_lock_irqsave, since it will be called in func spin_lock_irqsave."

This reverts commit 8f3a2a6f7645dd95b6a7608b9cde3cb693b118c2.
This commit is contained in:
Xiang Xiao 2025-02-06 22:58:33 +08:00 committed by archer
parent 99c7b64072
commit 45422e2ad9
5 changed files with 14 additions and 0 deletions

View File

@ -116,6 +116,7 @@ static int adjtime_start(long long adjust_usec)
}
flags = spin_lock_irqsave(&g_adjtime_lock);
sched_lock();
/* Set new adjustment */
@ -142,6 +143,7 @@ static int adjtime_start(long long adjust_usec)
}
spin_unlock_irqrestore(&g_adjtime_lock, flags);
sched_unlock();
return ret;
}

View File

@ -840,6 +840,7 @@ void _assert(FAR const char *filename, int linenum,
if (os_ready)
{
flags = spin_lock_irqsave(&g_assert_lock);
sched_lock();
}
#if CONFIG_BOARD_RESET_ON_ASSERT < 2
@ -913,5 +914,6 @@ void _assert(FAR const char *filename, int linenum,
if (os_ready)
{
spin_unlock_irqrestore(&g_assert_lock, flags);
sched_unlock();
}
}

View File

@ -31,6 +31,7 @@
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <sched.h>
#include <assert.h>
#include <nuttx/arch.h>
@ -360,6 +361,7 @@ void work_notifier_signal(enum work_evtype_e evtype,
*/
flags = spin_lock_irqsave(&g_notifier_lock);
sched_lock();
/* Process the notification at the head of the pending list until the
* pending list is empty
@ -403,6 +405,7 @@ void work_notifier_signal(enum work_evtype_e evtype,
}
spin_unlock_irqrestore(&g_notifier_lock, flags);
sched_unlock();
}
#endif /* CONFIG_WQUEUE_NOTIFIER */

View File

@ -69,6 +69,7 @@ static void work_timer_expiry(wdparm_t arg)
FAR struct work_s *work = (FAR struct work_s *)arg;
irqstate_t flags = spin_lock_irqsave(&work->wq->lock);
sched_lock();
/* We have being canceled */
@ -78,6 +79,7 @@ static void work_timer_expiry(wdparm_t arg)
}
spin_unlock_irqrestore(&work->wq->lock, flags);
sched_unlock();
}
static bool work_is_canceling(FAR struct kworker_s *kworkers, int nthreads,
@ -182,8 +184,10 @@ int work_queue_wq(FAR struct kwork_wqueue_s *wqueue,
if (!delay)
{
sched_lock();
queue_work(wqueue, work);
spin_unlock_irqrestore(&wqueue->lock, flags);
sched_unlock();
}
else
{

View File

@ -27,6 +27,7 @@
#include <nuttx/config.h>
#include <unistd.h>
#include <sched.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -204,7 +205,9 @@ static int work_thread(int argc, FAR char *argv[])
while (kworker->wait_count > 0)
{
kworker->wait_count--;
sched_lock();
nxsem_post(&kworker->wait);
sched_unlock();
}
}