Safe termination of RTSP server
This commit is contained in:
parent
ac625b0e9f
commit
4592d53ed5
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ private:
|
|||
std::thread _serverThread;
|
||||
|
||||
RTSPServer* _rtspServer;
|
||||
char volatile _eventLoopWatch;
|
||||
};
|
||||
|
||||
} /* namespace piscan */
|
||||
|
|
|
|||
Loading…
Reference in New Issue