Support BOOST_ASIO_NO_TS_EXECUTORS

This commit is contained in:
Richard Hodges
2020-07-04 07:35:14 +02:00
parent 5f1adfbc6d
commit 060f59685c
20 changed files with 285 additions and 92 deletions
@@ -240,7 +240,7 @@ int main(int argc, char** argv)
// The async operations will run on the system_executor.
// Because the main thread has nothing to do in this example, we just wait
// for the system_executor to run out of work.
net::system_executor().context().join();
net::query(net::system_executor(), net::execution::context).join();
return EXIT_SUCCESS;
}
+5 -2
View File
@@ -356,7 +356,10 @@ int main(int argc, char* argv[])
net::io_context ioc;
// The work keeps io_context::run from returning
auto work = net::make_work_guard(ioc);
auto work = net::any_io_executor(
net::prefer(
ioc.get_executor(),
net::execution::outstanding_work.tracked));
// The report holds the aggregated statistics
crawl_report report{ioc};
@@ -395,7 +398,7 @@ int main(int argc, char* argv[])
// If this is the last thread, reset the
// work object so that it can return from run.
if(i == workers.size() - 1)
work.reset();
work = {};
// Wait for the thread to exit
thread.join();