switch from deprecated io_service to io_context

This commit is contained in:
badaix 2019-09-28 10:53:58 +02:00
parent c4a61dff47
commit 1974afc176
7 changed files with 25 additions and 25 deletions

View file

@ -201,17 +201,17 @@ int main(int argc, char* argv[])
if (settings.bufferMs < 400)
settings.bufferMs = 400;
asio::io_service io_service;
std::unique_ptr<StreamServer> streamServer(new StreamServer(&io_service, settings));
asio::io_context io_context;
std::unique_ptr<StreamServer> streamServer(new StreamServer(&io_context, settings));
streamServer->start();
auto func = [](asio::io_service* ioservice) -> void { ioservice->run(); };
std::thread t(func, &io_service);
auto func = [](asio::io_context* ioservice) -> void { ioservice->run(); };
std::thread t(func, &io_context);
while (!g_terminated)
chronos::sleep(100);
io_service.stop();
io_context.stop();
t.join();
LOG(INFO) << "Stopping streamServer" << endl;