You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "wwbmmm (via GitHub)" <gi...@apache.org> on 2024/05/06 02:19:23 UTC

Re: [PR] bthread set concurrency by tag (brpc)

wwbmmm commented on code in PR #2628:
URL: https://github.com/apache/brpc/pull/2628#discussion_r1590482255


##########
src/brpc/server.cpp:
##########
@@ -1020,7 +1031,16 @@ int Server::StartInternal(const butil::EndPoint& endpoint,
         if (_options.num_threads < BTHREAD_MIN_CONCURRENCY) {
             _options.num_threads = BTHREAD_MIN_CONCURRENCY;
         }
-        bthread_setconcurrency(_options.num_threads);
+        int res;
+        if (original_bthread_tag == BTHREAD_TAG_INVALID) {
+            res = bthread_setconcurrency(_options.num_threads);
+        } else {
+            res = bthread_setconcurrency_by_tag(_options.num_threads, _options.bthread_tag);
+        }
+        if (res != 0) {
+            LOG(ERROR) << "Invalid set bthread concurrency to " << _options.num_threads;
+            return -1;

Review Comment:
   原先的逻辑bthread_setconcurrency失败不会返回错误,这里不兼容了



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org