[vlc-devel] [PATCH 01/10] clock: add vlc_clock_IsMaster

Thomas Guillem thomas at gllm.fr
Wed Mar 20 16:22:20 CET 2019


On Wed, Mar 20, 2019, at 14:08, Rémi Denis-Courmont wrote:
> This does not seem to make much sense. 
> 
> Either taking the mutex is not necessary and it should be removed. Or it is necessary, and the value is intrinsically no longer valid once the mutex is released, such that no inferences can be made from it.
> 
> So the patch looks wrong one way or the other.

We have a vlc_clock_SetMaster that is unused. I'll remove it since I doubt we will use it for 4.0. That way I will be able to remove the mutex here.

> 
> Le 20 mars 2019 00:45:16 GMT+08:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>>  src/clock/clock.c | 8 ++++++++
>>  src/clock/clock.h | 5 +++++
>>  2 files changed, 13 insertions(+)
>> 
>> diff --git a/src/clock/clock.c b/src/clock/clock.c
>> index 15a6cf68e4..bc8eff55b7 100644
>> --- a/src/clock/clock.c
>> +++ b/src/clock/clock.c
>> @@ -551,6 +551,14 @@ void vlc_clock_main_SetMaster(vlc_clock_main_t *main_clock, vlc_clock_t *clock)
>>      vlc_mutex_unlock(&main_clock->lock);
>>  }
>>  
>> +bool vlc_clock_IsMaster(vlc_clock_t *clock)
>> +{
>> +    vlc_clock_main_t *main_clock = clock->owner;
>> +    vlc_mutex_lock(&main_clock->lock);
>> +    bool is_master = main_clock->master == clock;
>> +    vlc_mutex_unlock(&main_clock->lock);
>> +    return is_master;
>> +}
>>  
>>  void vlc_clock_Delete(vlc_clock_t *clock)
>>  {
>> diff --git a/src/clock/clock.h b/src/clock/clock.h
>> index 8f281523d8..c11a3d1234 100644
>> --- a/src/clock/clock.h
>> +++ b/src/clock/clock.h
>> @@ -93,6 +93,11 @@ vlc_clock_t *vlc_clock_CreateSlave(const vlc_clock_t *clock);
>>   */
>>  void vlc_clock_Delete(vlc_clock_t *clock);
>>  
>> +/**
>> + * This function returns true if the current clock is the master one
>> + */
>> +bool vlc_clock_IsMaster(vlc_clock_t *clock);
>> +
>>  /**
>>   * This function will update the clock drift and returns the drift
>>   */
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190320/a6148b13/attachment.html>


More information about the vlc-devel mailing list