Example #1
0
/*! this is why we went through all this efford. You're in control of the event lopp. huray!!!
 * this version is more suitable for realtime applications
 * */
void the_non_blocking_loop(boost::asio::io_service& io_service)
{
	while (true)
	{
		while (io_service.poll_one());

		// do some other work, e.g. sleep
		std::this_thread::sleep_for(std::chrono::milliseconds(100));
	}
}
Example #2
0
void pump_and_run()
{
    assert_false(comp.complete_);
    int n = 0;
    while (n < 50 && !comp.complete_) {
        n += 1;
        svc.reset();
        svc.poll_one();
    }
    assert_true(comp.complete_);
}