BiteTheDDDDt commented on code in PR #23237:
URL: https://github.com/apache/doris/pull/23237#discussion_r1300827146


##########
be/src/util/blocking_priority_queue.hpp:
##########
@@ -154,14 +157,15 @@ class BlockingPriorityQueue {
         }
 
         _queue.push(val);
+        unique_lock.unlock();

Review Comment:
   putting the notify_one before unlock:
   notifying thread: notify -> eventually release lock
   notified thread: awaken -> attempt to acquire lock and fail -> block until 
lock available -> acquire lock after 
   notifying thread releases it
   
   putting the notify_one after unlock:
   notifying thread: notify 
   notified thread: awaken -> attempt to acquire lock and succeed
   
   
https://stackoverflow.com/questions/55154462/c-condition-variable-notify-one-before-or-after-release-lock



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to