TaiJuWu commented on issue #1488:
URL: https://github.com/apache/nuttx/issues/1488#issuecomment-1712039739

   Hello. I try to implement fair spinlock and put on 
[this.](https://github.com/TaiJuWu/nuttx/blob/1452773ead23ffa814800733db266b52cd066715/sched/semaphore/spinlock.c#L400)
   I try to test by this 
[file.](https://github.com/TaiJuWu/nuttx-apps/blob/fair_spinlock_test/examples/hello/hello_main.c)
   The result like this
   ```
   Thread 6 is exiting lock 4 time.
   Thread 7 is enter lock 4 time.
   Thread 7 is exiting lock 4 time.
   Thread 6 is enter lock 5 time.
   Thread 6 is exiting lock 5 time.
   Thread 7 is enter lock 5 time.
   Thread 7 is exiting lock 5 time.
   Thread 8 is enter lock 1 time.
   Thread 8 is exiting lock 1 time.
   Thread 9 is enter lock 1 time.
   Thread 9 is exiting lock 1 time.
   Thread 8 is enter lock 2 time.
   Thread 8 is exiting lock 2 time.
   Thread 9 is enter lock 2 time.
   Thread 9 is exiting lock 2 time.
   Thread 8 is enter lock 3 time.
   Thread 8 is exiting lock 3 time.
   Thread 9 is enter lock 3 time.
   Thread 9 is exiting lock 3 time.
   Thread 8 is enter lock 4 time.
   Thread 8 is exiting lock 4 time.
   ```
   But I only test on RR scheduler and I am not sure my implementation is 
correct or not.
   So I hope I can get some suggestions from community.
   If you have any suggestions, i would be very grateful. 
   
   PS. I did't implement preemptive for this fair spinlock.
   


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

Reply via email to