You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "BiteTheDDDDt (via GitHub)" <gi...@apache.org> on 2023/08/22 02:09:53 UTC

[GitHub] [doris] BiteTheDDDDt commented on a diff in pull request #23237: [Bug](thread-pool) try to fix pv operator of work thread pool

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

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


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