mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-25 05:57:04 +02:00
control and stream server use a central io_service
This commit is contained in:
parent
6435325821
commit
026ab84f0b
5 changed files with 55 additions and 39 deletions
|
@ -131,12 +131,21 @@ int main(int argc, char* argv[])
|
|||
if (settings.bufferMs < 400)
|
||||
settings.bufferMs = 400;
|
||||
settings.sampleFormat = sampleFormat;
|
||||
std::unique_ptr<StreamServer> streamServer(new StreamServer(settings));
|
||||
|
||||
boost::asio::io_service io_service;
|
||||
auto func = [](boost::asio::io_service* ioservice)->void{ioservice->run();};
|
||||
std::thread t(func, &io_service);
|
||||
|
||||
std::unique_ptr<StreamServer> streamServer(new StreamServer(&io_service, settings));
|
||||
streamServer->start();
|
||||
|
||||
while (!g_terminated)
|
||||
usleep(100*1000);
|
||||
|
||||
io_service.stop();
|
||||
t.join();
|
||||
|
||||
|
||||
logO << "Stopping streamServer" << endl;
|
||||
streamServer->stop();
|
||||
logO << "done" << endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue