int main() { function2 f2; const function2 cf2; function3 f3; handler2 h2; const handler2 ch2; handler3 h3; std::experimental::loop_scheduler scheduler; auto ex = make_executor(scheduler); std::experimental::executor::work w = ex.make_work(); std::thread t([&](){ scheduler.run(); }); std::experimental::post(ex, function1, handler1); std::experimental::post(ex, function1, &handler1); std::experimental::post(ex, function1, handler2()); std::experimental::post(ex, function1, h2); std::experimental::post(ex, function1, ch2); std::experimental::post(ex, function1, handler3()); std::experimental::post(ex, function1, std::move(h3)); std::future<void> fut1 = std::experimental::post(ex, function1, std::experimental::use_future); fut1.get(); std::experimental::post(ex, &function1, handler1); std::experimental::post(ex, &function1, &handler1); std::experimental::post(ex, &function1, handler2()); std::experimental::post(ex, &function1, h2); std::experimental::post(ex, &function1, ch2); std::experimental::post(ex, &function1, handler3()); std::experimental::post(ex, &function1, std::move(h3)); std::future<void> fut2 = std::experimental::post(ex, &function1, std::experimental::use_future); fut2.get(); std::experimental::post(ex, function2(), handler1); std::experimental::post(ex, function2(), &handler1); std::experimental::post(ex, function2(), handler2()); std::experimental::post(ex, function2(), h2); std::experimental::post(ex, function2(), ch2); std::experimental::post(ex, function2(), handler3()); std::experimental::post(ex, function2(), std::move(h3)); std::future<void> fut3 = std::experimental::post(ex, function2(), std::experimental::use_future); fut3.get(); std::experimental::post(ex, f2, handler1); std::experimental::post(ex, f2, &handler1); std::experimental::post(ex, f2, handler2()); std::experimental::post(ex, f2, h2); std::experimental::post(ex, f2, ch2); std::experimental::post(ex, f2, handler3()); std::experimental::post(ex, f2, std::move(h3)); std::future<void> fut4 = std::experimental::post(ex, f2, std::experimental::use_future); fut4.get(); std::experimental::post(ex, cf2, handler1); std::experimental::post(ex, cf2, &handler1); std::experimental::post(ex, cf2, handler2()); std::experimental::post(ex, cf2, h2); std::experimental::post(ex, cf2, ch2); std::experimental::post(ex, cf2, handler3()); std::experimental::post(ex, cf2, std::move(h3)); std::future<void> fut5 = std::experimental::post(ex, cf2, std::experimental::use_future); fut5.get(); std::experimental::post(ex, function3(), handler1); std::experimental::post(ex, function3(), &handler1); std::experimental::post(ex, function3(), handler2()); std::experimental::post(ex, function3(), h2); std::experimental::post(ex, function3(), ch2); std::experimental::post(ex, function3(), handler3()); std::experimental::post(ex, function3(), std::move(h3)); std::future<void> fut6 = std::experimental::post(ex, function3(), std::experimental::use_future); fut6.get(); std::experimental::post(ex, std::move(f3), handler1); std::experimental::post(ex, std::move(f3), &handler1); std::experimental::post(ex, std::move(f3), handler2()); std::experimental::post(ex, std::move(f3), h2); std::experimental::post(ex, std::move(f3), ch2); std::experimental::post(ex, std::move(f3), handler3()); std::experimental::post(ex, std::move(f3), std::move(h3)); std::future<void> fut7 = std::experimental::post(ex, std::move(f3), std::experimental::use_future); fut7.get(); w = nullptr; assert(!w); assert(w == nullptr); assert(nullptr == w); assert(!(w != nullptr)); assert(!(nullptr != w)); t.join(); assert(function_count == 56); assert(handler_count == 49); }
bool work_queue::add(void_function0& f) { return add(make_work(&void_function0::operator(), &f)); }
void work_queue::schedule(duration d, void_function0& f) { schedule(d, make_work(&void_function0::operator(), &f)); }
void container::schedule(duration d, void_function0& f) { return impl_->schedule(d, make_work(&void_function0::operator(), &f)); }