add API to get the number of threads in a threadpool

master
Daniel Kolesa 2018-04-22 17:40:37 +02:00
parent 230ece9fb6
commit 097722b1ed
2 changed files with 9 additions and 0 deletions

View File

@ -251,6 +251,10 @@ struct make {
return p_rules.back(); return p_rules.back();
} }
unsigned int threads() const noexcept {
return p_tpool.threads();
}
private: private:
struct rule_inst { struct rule_inst {

View File

@ -196,6 +196,11 @@ struct thread_pool {
return ret; return ret;
} }
/** @brief Gets the number of threads in the pool. */
unsigned int threads() const noexcept {
return p_thrs.size();
}
private: private:
void thread_run() { void thread_run() {
for (;;) { for (;;) {