wangchdo commented on code in PR #17223:
URL: https://github.com/apache/nuttx/pull/17223#discussion_r2455134817


##########
include/nuttx/event.h:
##########
@@ -73,7 +73,6 @@ struct nxevent_s
 {
   struct list_node         list;   /* Waiting list of nxevent_wait_t */
   volatile nxevent_mask_t  events; /* Pending Events */
-  spinlock_t               lock;   /* Spinlock */

Review Comment:
   This is mainly for removing reliance on semaphore, after removing semaphore, 
we will use critical section to protect event, and spinlock is not needed any 
more.
   
   The reason to remove semaphore is that it is too heavy for event timeout:
   1. It has global big lock inside the sema_wait/sema_post api,so in fact 
there are double lock here: spinlock for event and critical section lock for 
semaphore
   2. Semaphore object costs more memory
   3. It has lost of logic inside sema_wait and sema_post that are not related 
to event timeout
   
   
   Indeed the lock scope is very small in event, and after removing semaphore 
it is even smaller, so i think this would be better
   
   By the way The current spinlock is also a global one for event post, it uses 
spinlock_unpreemt api. 
   
   How do you think?



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