From: Andreas Ă–man Date: Sun, 21 Sep 2008 18:16:14 +0000 (+0000) Subject: Fix deadlock issues in dvr when recording is completed X-Git-Tag: 2.12~849 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3cf7ff5cc5ccc1d4ed709cba96cd4b82b9a3ff2;p=thirdparty%2Ftvheadend.git Fix deadlock issues in dvr when recording is completed --- diff --git a/dvr/dvr_rec.c b/dvr/dvr_rec.c index 32cc5886b..997cd82a3 100644 --- a/dvr/dvr_rec.c +++ b/dvr/dvr_rec.c @@ -444,6 +444,8 @@ dvr_rec_stop(dvr_entry_t *de) if(st->st_status == ST_RUNNING) { st->st_status = ST_STOP_REQ; + pthread_cond_signal(&st->st_cond); + while(st->st_status != ST_ZOMBIE) pthread_cond_wait(&st->st_cond, &st->st_mutex); } @@ -488,16 +490,16 @@ dvr_thread(void *aux) pthread_mutex_lock(&st->st_mutex); } - dvr_thread_epilog(de); - - streaming_target_disconnect(&de->de_st); - /* Signal back that we no longer is running */ st->st_status = ST_ZOMBIE; pthread_cond_signal(&st->st_cond); pthread_mutex_unlock(&st->st_mutex); + dvr_thread_epilog(de); + + streaming_target_disconnect(&de->de_st); + pthread_mutex_lock(&global_lock); dvr_entry_dec_ref(de); /* Past this we may no longer