Bosma/Scheduler

'now' method

Closed this issue · 2 comments

Hi!
Can you add 'now' method for executing some code inside Bosma::Scheduller workers thread pool like this:
template<typename _Callable, typename... _Args> void now(_Callable &&f, _Args &&... args) {
in(std::chrono::nanoseconds(0), std::forward<_Callable>(f), std::forward<_Args>(args)...);
}
This feature in my project help me for free main thread execution using Bosma::Scheduller features.
To your notice =)

I create pull request for this feature
#6

Bosma commented

Thanks for the suggestion, but I would like to keep the library simple, so you should instead call s.in(0s, []() { std::cout << "now" << std::endl; }); directly or write your own wrapper.