MCPcopy Create free account
hub / github.com/apache/brpc / choose_one_group

Method choose_one_group

src/bthread/task_control.cpp:320–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320TaskGroup* TaskControl::choose_one_group(bthread_tag_t tag) {
321 CHECK(tag >= BTHREAD_TAG_DEFAULT && tag < FLAGS_task_group_ntags);
322 auto& groups = tag_group(tag);
323 const auto ngroup = tag_ngroup(tag).load(butil::memory_order_acquire);
324 if (ngroup != 0) {
325 return groups[butil::fast_rand_less_than(ngroup)];
326 }
327 CHECK(false) << "Impossible: ngroup is 0";
328 return NULL;
329}
330
331int TaskControl::parse_cpuset(std::string value, std::vector<unsigned>& cpus) {
332 static std::regex r("(\\d+-)?(\\d+)(,(\\d+-)?(\\d+))*");

Callers 5

get_task_groupFunction · 0.80
butex_requeueFunction · 0.80
start_from_non_workerFunction · 0.80
interruptMethod · 0.80

Calls 2

fast_rand_less_thanFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected