[vlc-devel] [PATCH] decoder: re-order save/restore cancel
Rémi Denis-Courmont
remi at remlab.net
Tue Sep 12 13:28:24 CEST 2017
Le 12 septembre 2017 13:59:57 GMT+03:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>Mainly to clarify and use the same order when locking/restoring and
>saving/unlocking.
>
>This doesn't change anything since the thread cancellation type is
>deferred.
>---
> src/input/decoder.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/src/input/decoder.c b/src/input/decoder.c
>index 109d5a2205..57273805d5 100644
>--- a/src/input/decoder.c
>+++ b/src/input/decoder.c
>@@ -1531,7 +1531,6 @@ static void *DecoderThread( void *p_data )
> { /* Flush before/regardless of pause. We do not want to resume just
> * for the sake of flushing (glitches could otherwise happen). */
> int canc = vlc_savecancel();
>-
> vlc_fifo_Unlock( p_owner->p_fifo );
>
> /* Flush the decoder (and the output) */
>@@ -1550,10 +1549,10 @@ static void *DecoderThread( void *p_data )
>
> if( paused != p_owner->paused )
> { /* Update playing/paused status of the output */
>- int canc = vlc_savecancel();
> mtime_t date = p_owner->pause_date;
>-
> paused = p_owner->paused;
>+
>+ int canc = vlc_savecancel();
> vlc_fifo_Unlock( p_owner->p_fifo );
>
> /* NOTE: Only the audio and video outputs care about pause. */
>@@ -1563,8 +1562,8 @@ static void *DecoderThread( void *p_data )
> if( p_owner->p_aout != NULL )
> aout_DecChangePause( p_owner->p_aout, paused, date );
>
>- vlc_restorecancel( canc );
> vlc_fifo_Lock( p_owner->p_fifo );
>+ vlc_restorecancel( canc );
> continue;
> }
>
>@@ -1593,9 +1592,9 @@ static void *DecoderThread( void *p_data )
> * drain. Pass p_block = NULL to decoder just once. */
> }
>
>+ int canc = vlc_savecancel();
> vlc_fifo_Unlock( p_owner->p_fifo );
>
>- int canc = vlc_savecancel();
> DecoderProcess( p_dec, p_block );
>
> if( p_block == NULL )
>@@ -1604,7 +1603,6 @@ static void *DecoderThread( void *p_data )
> if( p_owner->p_aout != NULL )
> aout_DecFlush( p_owner->p_aout, true );
> }
>- vlc_restorecancel( canc );
>
> /* TODO? Wait for draining instead of polling. */
> vlc_mutex_lock( &p_owner->lock );
>@@ -1616,6 +1614,8 @@ static void *DecoderThread( void *p_data )
> vlc_fifo_Lock( p_owner->p_fifo );
> vlc_cond_signal( &p_owner->wait_acknowledge );
> vlc_mutex_unlock( &p_owner->lock );
>+
>+ vlc_restorecancel( canc );
> }
> vlc_cleanup_pop();
> vlc_assert_unreachable();
>--
>2.11.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
I disagree. cancellation should be disabled the least. This documents the fact that the code is cancellation-safe, one way (no cancellation point) or another (proper clean-up handlers).
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
More information about the vlc-devel
mailing list