fix potential deadlock while shutting down
This commit is contained in:
@@ -36,7 +36,7 @@ static inline int rtsp_playing(void) {
|
||||
|
||||
static void rtsp_take_player(void) {
|
||||
if (pthread_mutex_trylock(&playing_mutex)) {
|
||||
debug("another thread is playing, shutting it down\n");
|
||||
debug("shutting down playing thread\n");
|
||||
// XXX minor race condition between please_shutdown and signal delivery
|
||||
please_shutdown = 1;
|
||||
pthread_kill(playing_thread, SIGUSR1);
|
||||
|
||||
+4
-1
@@ -4,8 +4,11 @@
|
||||
#include "rtsp.h"
|
||||
#include "mdns.h"
|
||||
|
||||
|
||||
static int shutting_down = 0;
|
||||
static void shutdown(void) {
|
||||
if (shutting_down)
|
||||
return;
|
||||
shutting_down = 1;
|
||||
printf("Shutting down...\n");
|
||||
mdns_unregister();
|
||||
rtsp_shutdown_stream();
|
||||
|
||||
Reference in New Issue
Block a user