hujun260 commented on code in PR #18049:
URL: https://github.com/apache/nuttx/pull/18049#discussion_r2716010397
##########
include/nuttx/spinlock.h:
##########
@@ -548,14 +568,22 @@ irqstate_t spin_lock_irqsave_nopreempt(FAR volatile
spinlock_t *lock)
*
****************************************************************************/
+#ifdef CONFIG_SPINLOCK
static inline_function
-irqstate_t rspin_lock_irqsave(FAR rspinlock_t *lock)
+void rspin_lock(FAR rspinlock_t *lock)
{
rspinlock_t new_val;
rspinlock_t old_val = RSPINLOCK_INITIALIZER;
- irqstate_t flags = up_irq_save();
int cpu = this_cpu() + 1;
+ /* Already owned this lock. */
+
+ if (lock->owner == cpu)
Review Comment:
rspin_lock can be used independently, but only in scenarios where interrupts
are masked.
I will submit a PR later to replace enter_critical_section with
rspin_lock_irqsave,
which will demonstrate the independent usage of rspin_lock.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]