Skip to content

Commit

Permalink
add check for bthread_setconcurrency_by_tag (#2784)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglimingcn authored Oct 15, 2024
1 parent f6f76dd commit 938bf46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bthread/bthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 938bf46

Please sign in to comment.