From c1c1eb195186ebdc2cb3cce241ec7d52aa28076b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 7 Jan 2019 15:49:34 +0100 Subject: [PATCH] rtp: fix joining of re_main thread --- lib/nodes/rtp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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");