TaiJuWu commented on code in PR #10605:
URL: https://github.com/apache/nuttx/pull/10605#discussion_r1331400349


##########
arch/arm64/include/spinlock.h:
##########
@@ -83,6 +83,25 @@
  * -- Clear Exclusive access monitor (CLREX) This is used to
  *     clear the state of the Local Exclusive Monitor.
  */
+#if defined(CONFIG_TICKET_SPINLOCK)
+#include <stdatomic.h>
+
+/* Memory layout is related uint64_t in arm64 little endian
+ * if uint64 is 0x010203040A0B0C0D, the next is 0A0B0C0D and
+ * the owner is 01020304.
+ */
+
+struct ticket_spinlock_s
+{
+    atomic_uint next;
+    atomic_uint owner;
+};
+typedef struct ticket_spinlock_s ticket_spinlock_t;
+
+#define OWNER(l) (((struct ticket_spinlock_s *)l)->owner)
+#define NEXT(l) (((struct ticket_spinlock_s *)l)->next)

Review Comment:
   You are right and this suggestion is very useful.
   There are many place using this macro and it's easy for reading.
   Maybe we can think a new name?
   
   How about LOCK_WONER and LOCK_NEXT?



-- 
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

Reply via email to