forked from OctaForge/libostd
only bind when args are passed
This commit is contained in:
parent
35cda8872e
commit
3462703b3a
|
@ -60,9 +60,13 @@ struct thread_pool {
|
||||||
if (!p_running) {
|
if (!p_running) {
|
||||||
throw std::runtime_error{"push on stopped thread_pool"};
|
throw std::runtime_error{"push on stopped thread_pool"};
|
||||||
}
|
}
|
||||||
|
if constexpr(sizeof...(A) == 0) {
|
||||||
|
p_tasks.push(std::forward<F>(func));
|
||||||
|
} else {
|
||||||
p_tasks.push(
|
p_tasks.push(
|
||||||
std::bind(std::forward<F>(func), std::forward<A>(args)...)
|
std::bind(std::forward<F>(func), std::forward<A>(args)...)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
p_cond.notify_one();
|
p_cond.notify_one();
|
||||||
} else {
|
} else {
|
||||||
/* non-void-returning funcs return a future */
|
/* non-void-returning funcs return a future */
|
||||||
|
|
Loading…
Reference in a new issue