[vlc-devel] [PATCH 01/10] clock: add vlc_clock_IsMaster
Rémi Denis-Courmont
remi at remlab.net
Wed Mar 20 14:07:52 CET 2019
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.
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
> */
>--
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190320/96ab2e07/attachment.html>
More information about the vlc-devel
mailing list