forked from OctaForge/libostd
add API to get the number of threads in a threadpool
This commit is contained in:
parent
230ece9fb6
commit
097722b1ed
2 changed files with 9 additions and 0 deletions
|
@ -251,6 +251,10 @@ struct make {
|
|||
return p_rules.back();
|
||||
}
|
||||
|
||||
unsigned int threads() const noexcept {
|
||||
return p_tpool.threads();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct rule_inst {
|
||||
|
|
|
@ -196,6 +196,11 @@ struct thread_pool {
|
|||
return ret;
|
||||
}
|
||||
|
||||
/** @brief Gets the number of threads in the pool. */
|
||||
unsigned int threads() const noexcept {
|
||||
return p_thrs.size();
|
||||
}
|
||||
|
||||
private:
|
||||
void thread_run() {
|
||||
for (;;) {
|
||||
|
|
Loading…
Reference in a new issue