xiaoxiang781216 commented on code in PR #14578: URL: https://github.com/apache/nuttx/pull/14578#discussion_r1924956310
########## include/nuttx/spinlock.h: ########## @@ -584,15 +584,15 @@ irqstate_t spin_lock_irqsave(FAR volatile spinlock_t *lock) #ifdef CONFIG_SPINLOCK static inline_function -void spin_unlock_irqrestore_wo_note(FAR volatile spinlock_t *lock, +void raw_spin_unlock_irqrestore(FAR volatile spinlock_t *lock, irqstate_t flags) Review Comment: align ########## sched/sched/sched_lock.c: ########## @@ -64,112 +64,26 @@ * ****************************************************************************/ -#ifdef CONFIG_SMP - -int sched_lock(void) +void sched_lock(void) { FAR struct tcb_s *rtcb; - /* If the CPU supports suppression of interprocessor interrupts, then - * simple disabling interrupts will provide sufficient protection for - * the following operation. - */ - - rtcb = this_task(); - - /* Check for some special cases: (1) rtcb may be NULL only during early - * boot-up phases, and (2) sched_lock() should have no effect if called - * from the interrupt level. - */ - - if (rtcb != NULL && !up_interrupt_context()) + if (!up_interrupt_context()) { - irqstate_t flags; - - /* Catch attempts to increment the lockcount beyond the range of the - * integer type. - */ - - DEBUGASSERT(rtcb->lockcount < MAX_LOCK_COUNT); - - flags = enter_critical_section(); - - /* A counter is used to support locking. This allows nested lock - * operations on this thread - */ - - rtcb->lockcount++; - - /* Check if we just acquired the lock */ - - if (rtcb->lockcount == 1) + rtcb = this_task(); + if (rtcb != NULL) { - /* Note that we have pre-emption locked */ - -#if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0 - nxsched_critmon_preemption(rtcb, true, return_address(0)); -#endif -#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION - sched_note_preemption(rtcb, true); + if (rtcb->lockcount++ == 0) Review Comment: merge with line 74 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org