zhengJade commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1875215957
##########
src/bthread/task_control.cpp:
##########
@@ -441,6 +453,18 @@ void TaskControl::signal_task(int num_task, bthread_tag_t
tag) {
if (num_task > 2) {
num_task = 2;
}
+ if (ParkingLot::_waiting_count.load(std::memory_order_acquire) == 0) {
+ if (FLAGS_bthread_min_concurrency > 0 &&
+ _concurrency.load(butil::memory_order_relaxed) <
FLAGS_bthread_concurrency) {
+ // TODO: Reduce this lock
+ BAIDU_SCOPED_LOCK(g_task_control_mutex);
+ if (_concurrency.load(butil::memory_order_acquire) <
FLAGS_bthread_concurrency) {
+ add_workers(1, tag);
+ }
Review Comment:
这里我当时写的时候其实不能够确定这一步是否一定要求 _concurrency 值的准确性,即使数量有误差,后面再判断的时候也能 add worker
出来,但是考虑到原来的使用的是 memory_order_acquire,就延用了
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]