patacongo commented on code in PR #9528:
URL: https://github.com/apache/nuttx/pull/9528#discussion_r1228411789
##########
sched/group/group_join.c:
##########
@@ -208,9 +218,12 @@ int group_join(FAR struct pthread_tcb_s *tcb)
{
return ret;
}
+#else
+ flags = enter_critical_section();
Review Comment:
There are some special interfaces for this: spin_lock_irqsave() and
spin_unlock_irqrestore(). When SMP is enabled, these use a spinlock to manage
a critical section (and also disable local interrupts).
If SMP is disabled, then it works just like enter_critical_section() (i.e.,
just disables local interrupts).
spin_lock_irqsave is MUCH lighter weight than enter_critical_section() in
SMP mode. That API has to communicate with all of CPUs and assure that they
are all stopped. spin_lock_irqsave() just uses a lightweight spinlock.
sin_lock_irqsave() has more limited usage, however: You can never suspend
the thread if it holds the spinlock whereas you can always wait while holding
the critical section.
--
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]