#include "evloop.hpp" #include "timer_items.hpp" #include "eventia/eventia.hpp" #include "eventia/timer.hpp" #include "roar11/ThreadPool.hpp" #include namespace duck { namespace { //class KeepaliveTimer : public ev::timer { //public: // KeepaliveTimer (ev::loop_ref& loop, RunningPool::subpool_type*) { // this->set(loop); // this->set(this); // ev::timer::start(5.0, 5.0); // } // void on_timer_ev() { // } //}; void join(roar11::ThreadPool& pool) { pool.join(); std::cout << "all tasks completed\n"; } } //unnamed namespace void test() { const std::size_t thread_count = 2U; //std::min(std::max(3U, std::thread::hardware_concurrency()) - 1, 4U); std::cout << "Running with " << thread_count << " worker threads\n"; roar11::ThreadPool pool(thread_count); eve::Eventia worker; pool.submit(worker.event_functor()); auto fetcher = worker.make_timer(3.0, &pool); join(pool); } } //namespace duck