Safe termination of RTSP server

This commit is contained in:
Ezra Taimuty-Loomis 2020-05-12 18:09:03 -04:00
parent ac625b0e9f
commit 4592d53ed5
2 changed files with 5 additions and 3 deletions

View File

@ -89,16 +89,17 @@ void AudioStreamServer::start(){
}
}
_eventLoopWatch = 0;
// TODO currently no way to terminate this thread in a friendly manner
_serverThread = std::thread([this]{
setThreadName("RTSP Server");
_rtspServer->envir().taskScheduler().doEventLoop(); // does not return
_rtspServer->envir().taskScheduler().doEventLoop(&_eventLoopWatch); // does not return
});
}
void AudioStreamServer::stop() {
_eventLoopWatch = 1;
_serverThread.join();
}
} /* namespace piscan */

View File

@ -31,6 +31,7 @@ private:
std::thread _serverThread;
RTSPServer* _rtspServer;
char volatile _eventLoopWatch;
};
} /* namespace piscan */