Fix-Point commented on code in PR #21342:
URL: https://github.com/apache/nuttx/pull/21342#discussion_r4442245084
##########
include/nuttx/spinlock.h:
##########
@@ -951,23 +1069,30 @@ void rspin_restorelock(FAR rspinlock_t *lock, uint16_t
count)
*
****************************************************************************/
-static inline_function void read_lock(FAR volatile rwlock_t *lock)
+# ifdef CONFIG_SPINLOCK_INLINE
+SPINLOCK_INLINE void read_lock(FAR volatile rwlock_t *lock)
{
nxsched_critmon_busywait(true, return_address(0));
-
- while (true)
+ for (; ; )
{
- int old = atomic_read(lock);
+ int32_t old = atomic_read(lock);
- if (old > RW_SP_WRITE_LOCKED &&
- atomic_cmpxchg_acquire(lock, &old, old + 1))
+ if (old > RW_SP_WRITE_LOCKED)
{
- break;
+ if (atomic_cmpxchg_acquire(lock, &old, old + 1))
+ {
+ break;
+ }
+
+ UP_WFE();
Review Comment:
Done
--
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]