You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/09/19 04:24:57 UTC

[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #10682: vnc_updater: use [enter|leave]_critical_section replace sched_[un]lock

xiaoxiang781216 commented on code in PR #10682:
URL: https://github.com/apache/nuttx/pull/10682#discussion_r1329559927


##########
drivers/video/vnc/vnc_updater.c:
##########
@@ -181,23 +182,24 @@ static FAR struct vnc_fbupdate_s *
 vnc_alloc_update(FAR struct vnc_session_s *session)
 {
   FAR struct vnc_fbupdate_s *update;
+  irqstate_t flags;
 
   /* Reserve one element from the free list.  Lock the scheduler to assure
    * that the sq_remfirst() and the successful return from nxsem_wait are
    * atomic.  Of course, the scheduler will be unlocked while we wait.
    */
 
-  sched_lock();
   vnc_sem_debug(session, "Before alloc", 0);
+  flags = enter_critical_section();
 
   nxsem_wait_uninterruptible(&session->freesem);
 
   /* It is reserved.. go get it */
 
   update = (FAR struct vnc_fbupdate_s *)sq_remfirst(&session->updfree);

Review Comment:
   Yes, since it's accessed by two thread and then possible on SMP.



-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org