chenBright commented on code in PR #2819: URL: https://github.com/apache/brpc/pull/2819#discussion_r1853350137
########## 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: 这里没必要重复写一遍add_workers逻辑。在后面`if (num_task > 0)`中加上`ParkingLot::_waiting_count.load(std::memory_order_acquire) > 0`就可以了吧? std::memory_order_acquire -> butil::memory_order_acquire ? 有必要用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: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org