This is an automated email from the ASF dual-hosted git repository.
wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 938bf46c add check for bthread_setconcurrency_by_tag (#2784)
938bf46c is described below
commit 938bf46c5f3f4b86069d36e297183b00a1649a14
Author: Yang,Liming <[email protected]>
AuthorDate: Tue Oct 15 12:04:18 2024 +0800
add check for bthread_setconcurrency_by_tag (#2784)
---
src/bthread/bthread.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/bthread/bthread.cpp b/src/bthread/bthread.cpp
index 0cbe628c..dcd29c43 100644
--- a/src/bthread/bthread.cpp
+++ b/src/bthread/bthread.cpp
@@ -391,6 +391,10 @@ int bthread_setconcurrency_by_tag(int num, bthread_tag_t
tag) {
} else if (tag < BTHREAD_TAG_DEFAULT || tag >= FLAGS_task_group_ntags) {
return EINVAL;
}
+ if (num < BTHREAD_MIN_CONCURRENCY || num > BTHREAD_MAX_CONCURRENCY) {
+ LOG(ERROR) << "Invalid concurrency_by_tag=" << num;
+ return EINVAL;
+ }
auto c = bthread::get_or_new_task_control();
BAIDU_SCOPED_LOCK(bthread::g_task_control_mutex);
auto ngroup = c->concurrency();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]