[vlc-devel] [PATCH 1/2] interrupt: restore interrupted to the killed state

Remi Denis-Courmont remi at remlab.net
Wed Oct 23 21:27:22 CEST 2019


Le 2019-10-23 22:25, Remi Denis-Courmont a écrit :
> Le 2019-10-22 17:47, Thomas Guillem a écrit :
>> If a module is interrupted while waiting in a vlc_*_i11e*() function, 
>> the i11e
>> function will return an error after restoring the interrupted state 
>> (from
>> vlc_interrupt_finish()). This error will be carefully handled by the 
>> module
>> that will close itself. If a second module is in the probe list, any 
>> call to a
>> vlc_*_i11e*() function will act as not interrupted. This cause any 
>> following
>> modules in the probe list to ignore this interrupted state.
>> 
>> To fix this issue, vlc_interrupt_finish() will now restore the 
>> interrupted
>> state to the killed state.
>> ---
>>  src/misc/interrupt.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c
>> index d2a04a72b3c..54810892fc1 100644
>> --- a/src/misc/interrupt.c
>> +++ b/src/misc/interrupt.c
>> @@ -151,7 +151,7 @@ static int vlc_interrupt_finish(vlc_interrupt_t 
>> *ctx)
>>      if (ctx->interrupted)
>>      {
>>          ret = EINTR;
>> -        ctx->interrupted = false;
>> +        ctx->interrupted = atomic_load(&ctx->killed);
> 
> This looks wrong. The interruption is only there to signal the change
> in status. It's not supposed to fire again if the status is not
> changed.

Worse than that. It will cause live loops, as it becomes impossible to 
poll after kill.

Nack.

>>      }
>>      vlc_mutex_unlock(&ctx->lock);
>>      return ret;

-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list