vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Feb 9 14:09:06 2020 +0200| [878b7247b18358443999535b7787205485e5a280] | committer: Rémi Denis-Courmont
vlm: do not use vlc_cancel() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=878b7247b18358443999535b7787205485e5a280 --- src/input/vlm.c | 16 +++++++++------- src/input/vlm_internal.h | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/input/vlm.c b/src/input/vlm.c index 4d75be64c8..e40615a431 100644 --- a/src/input/vlm.c +++ b/src/input/vlm.c @@ -169,6 +169,7 @@ vlm_t *vlm_New( libvlc_int_t *libvlc, const char *psz_vlmconf ) vlc_cond_init_daytime( &p_vlm->wait_manage ); p_vlm->users = 1; p_vlm->input_state_changed = false; + p_vlm->exiting = false; p_vlm->i_id = 1; TAB_INIT( p_vlm->i_media, p_vlm->media ); TAB_INIT( p_vlm->i_schedule, p_vlm->schedule ); @@ -239,7 +240,10 @@ void vlm_Delete( vlm_t *p_vlm ) TAB_CLEAN( p_vlm->i_schedule, p_vlm->schedule ); vlc_mutex_unlock( &p_vlm->lock ); - vlc_cancel( p_vlm->thread ); + vlc_mutex_lock( &p_vlm->lock_manage ); + p_vlm->exiting = true; + vlc_cond_signal( &p_vlm->wait_manage ); + vlc_mutex_unlock( &p_vlm->lock_manage ); if( p_vlm->p_vod ) { @@ -397,15 +401,15 @@ static void* Manage( void* p_object ) { vlm_t *vlm = (vlm_t*)p_object; time_t lastcheck; + bool exiting; time(&lastcheck); - for( ;; ) + do { char **ppsz_scheduled_commands = NULL; int i_scheduled_commands = 0; - int canc = vlc_savecancel (); /* destroy the inputs that wants to die, and launch the next input */ vlc_mutex_lock( &vlm->lock ); for( int i = 0; i < vlm->i_media; i++ ) @@ -511,12 +515,10 @@ static void* Manage( void* p_object ) lastcheck = now; vlc_mutex_unlock( &vlm->lock ); - vlc_restorecancel (canc); vlc_mutex_lock( &vlm->lock_manage ); - mutex_cleanup_push( &vlm->lock_manage ); - while( !vlm->input_state_changed ) + while( !vlm->input_state_changed && !(exiting = vlm->exiting) ) { if( nextschedule ) { @@ -529,9 +531,9 @@ static void* Manage( void* p_object ) vlc_cond_wait( &vlm->wait_manage, &vlm->lock_manage ); } vlm->input_state_changed = false; - vlc_cleanup_pop( ); vlc_mutex_unlock( &vlm->lock_manage ); } + while( !exiting ); return NULL; } diff --git a/src/input/vlm_internal.h b/src/input/vlm_internal.h index 65130352e9..d3d82a5e13 100644 --- a/src/input/vlm_internal.h +++ b/src/input/vlm_internal.h @@ -92,6 +92,7 @@ struct vlm_t /* tell vlm thread there is work to do */ bool input_state_changed; + bool exiting; /* */ int64_t i_id; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
