diff --git a/lib/nodes/rtp.c b/lib/nodes/rtp.c index 7b78a1580..1014ee2fd 100644 --- a/lib/nodes/rtp.c +++ b/lib/nodes/rtp.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -228,6 +229,14 @@ int rtp_type_start() return ret; } + struct sigaction sa; + sa.sa_flags = SA_SIGINFO; + sa.sa_sigaction = stop_handler; + + ret = sigaction(SIGUSR1, &sa, NULL); + if (ret) + return ret; + return ret; } @@ -236,8 +245,7 @@ int rtp_type_stop() int ret; /* Join worker thread */ - re_cancel(); - pthread_cancel(re_pthread); /* @todo avoid using pthread_cancel */ + pthread_kill(re_pthread, SIGUSR1); ret = pthread_join(re_pthread, NULL); if (ret) { error("Error joining rtp node type pthread");