Bosma / Scheduler

Modern C++ Scheduling Library
MIT License
272 stars 74 forks source link

'now' method #5

Closed asmyasnikov closed 6 years ago

asmyasnikov commented 6 years ago

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 =)

asmyasnikov commented 6 years ago

I create pull request for this feature https://github.com/Bosma/Scheduler/pull/6

Bosma commented 6 years ago

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.