| 318 | } |
| 319 | |
| 320 | TaskGroup* 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 | |
| 331 | int TaskControl::parse_cpuset(std::string value, std::vector<unsigned>& cpus) { |
| 332 | static std::regex r("(\\d+-)?(\\d+)(,(\\d+-)?(\\d+))*"); |
no test coverage detected