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


##########
sched/semaphore/spinlock.c:
##########
@@ -446,4 +446,225 @@ void spin_clrbit(FAR volatile cpu_set_t *set, unsigned 
int cpu,
 }
 #endif
 
+#ifdef CONFIG_RW_SPINLOCK
+
+/****************************************************************************
+ * Name: read_lock
+ *
+ * Description:
+ *   If this task does not already hold the spinlock, then loop until the
+ *   spinlock is successfully locked.
+ *
+ *   This implementation is non-reentrant and set a bit of lock.
+ *
+ *  The priority of reader is higher than writter if a reader hold the
+ *  lock, a new reader can get its lock but writer can't get this lock.
+ *
+ * Input Parameters:
+ *   lock - A reference to the spinlock object to lock.
+ *
+ * Returned Value:
+ *   None.  When the function returns, the spinlock was successfully locked
+ *   by this CPU.
+ *
+ * Assumptions:
+ *   Not running at the interrupt level.
+ *
+ ****************************************************************************/
+
+void read_lock(FAR volatile rwlock_t *lock)
+{
+  int old;

Review Comment:
   @xiaoxiang781216 I want to splite two commits on this PR ?
   One is the implementation of read-write spinlock and the other is for 
resolving Mac sim-02 compiler issue.
   Maybe we can revert the second commit if resolving this compiler issue of 
Mac sim-02.



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