[vlc-devel] [PATCH 20/20] input: remove hold/release
Thomas Guillem
thomas at gllm.fr
Fri May 31 15:59:46 CEST 2019
---
src/input/input.c | 20 +++-----------------
src/input/input_internal.h | 4 ----
2 files changed, 3 insertions(+), 21 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index d7cde9f8c5..31118f02c5 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -70,6 +70,7 @@ static void *Preparse( void * );
static input_thread_t * Create ( vlc_object_t *, input_thread_events_cb, void *,
input_item_t *, enum input_create_option option,
input_resource_t *, vlc_renderer_item_t * );
+static void Destroy ( input_thread_t *p_input );
static int Init ( input_thread_t *p_input );
static void End ( input_thread_t *p_input );
static void MainLoop( input_thread_t *p_input, bool b_interactive );
@@ -241,7 +242,7 @@ void input_Close( input_thread_t *p_input )
if( input_priv(p_input)->is_running )
vlc_join( input_priv(p_input)->thread, NULL );
vlc_interrupt_deinit( &input_priv(p_input)->interrupt );
- input_Release(p_input);
+ Destroy(p_input);
}
void input_SetTime( input_thread_t *p_input, vlc_tick_t i_time, bool b_fast )
@@ -438,28 +439,13 @@ static input_thread_t *Create( vlc_object_t *p_parent,
priv->p_es_out_display = input_EsOutNew( p_input, priv->rate );
priv->p_es_out = NULL;
- /* Set the destructor when we are sure we are initialized */
- atomic_init(&priv->refs, 0);
return p_input;
}
-input_thread_t *input_Hold(input_thread_t *input)
+static void Destroy(input_thread_t *input)
{
input_thread_private_t *priv = input_priv(input);
- atomic_fetch_add_explicit(&priv->refs, 1, memory_order_relaxed);
- return input;
-}
-
-void input_Release(input_thread_t *input)
-{
- input_thread_private_t *priv = input_priv(input);
-
- if (atomic_fetch_sub_explicit(&priv->refs, 1, memory_order_release))
- return;
-
- atomic_thread_fence(memory_order_acquire);
-
#ifndef NDEBUG
char *name = input_item_GetName(priv->p_item);
msg_Dbg(input, "destroying input for '%s'", name);
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index cfdc924319..cf9bb74861 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -361,9 +361,6 @@ input_thread_t *input_CreateThumbnailer(vlc_object_t *obj,
void *events_data, input_item_t *item)
VLC_USED;
-input_thread_t *input_Hold(input_thread_t *input);
-void input_Release(input_thread_t *input);
-
int input_Start( input_thread_t * );
void input_Stop( input_thread_t * );
@@ -542,7 +539,6 @@ typedef struct input_thread_private_t
vlc_thread_t thread;
vlc_interrupt_t interrupt;
- atomic_uintptr_t refs;
} input_thread_private_t;
static inline input_thread_private_t *input_priv(input_thread_t *input)
--
2.20.1
More information about the vlc-devel
mailing list