[vlc-commits] Remove dead old object thread code

Rémi Denis-Courmont git at videolan.org
Wed May 25 17:27:06 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue May 24 23:54:47 2011 +0300| [d09ce38afac838a3c53c43e921b7fa3a4ae49f52] | committer: Rémi Denis-Courmont

Remove dead old object thread code

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d09ce38afac838a3c53c43e921b7fa3a4ae49f52
---

 src/libvlc.h       |   13 --------
 src/misc/objects.c |   16 ++--------
 src/misc/threads.c |   84 ----------------------------------------------------
 3 files changed, 3 insertions(+), 110 deletions(-)

diff --git a/src/libvlc.h b/src/libvlc.h
index 75db8f0..99fc643 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -48,15 +48,6 @@ void system_End       ( libvlc_int_t * );
 /* This cannot be used as is from plugins yet: */
 int vlc_clone_detach (vlc_thread_t *, void *(*)(void *), void *, int);
 
-/* Hopefully, no need to export this. There is a new thread API instead. */
-int vlc_thread_create( vlc_object_t *, void * ( * ) ( vlc_object_t * ), int ) VLC_USED VLC_DEPRECATED;
-void vlc_thread_join( vlc_object_t * ) VLC_DEPRECATED;
-#define vlc_thread_create( P_THIS, FUNC, PRIORITY ) \
-    vlc_thread_create( VLC_OBJECT(P_THIS), FUNC, PRIORITY )
-#define vlc_thread_join( P_THIS )                                           \
-    vlc_thread_join( VLC_OBJECT(P_THIS) )
-
-void vlc_thread_cancel (vlc_object_t *);
 int vlc_object_waitpipe (vlc_object_t *obj);
 
 int vlc_set_priority( vlc_thread_t, int );
@@ -159,10 +150,6 @@ struct vlc_object_internals
     vlc_mutex_t     var_lock;
     vlc_cond_t      var_wait;
 
-    /* Thread properties, if any */
-    vlc_thread_t    thread_id;
-    bool            b_thread;
-
     /* Objects thread synchronization */
     int             pipes[2];
 
diff --git a/src/misc/objects.c b/src/misc/objects.c
index dcf76fc..ddc559b 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -158,7 +158,6 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     vlc_spin_init( &p_priv->ref_spin );
     p_priv->i_refcount = 1;
     p_priv->pf_destructor = NULL;
-    p_priv->b_thread = false;
     p_new->p_parent = NULL;
     p_priv->first = NULL;
 
@@ -264,9 +263,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
     if( p_priv->pf_destructor )
         p_priv->pf_destructor( p_this );
 
-    /* Any thread must have been cleaned up at this point. */
-    assert( !p_priv->b_thread );
-
     /* Destroy the associated variables. */
     var_DestroyAll( p_this );
 
@@ -390,7 +386,6 @@ void vlc_object_kill( vlc_object_t *p_this )
     vlc_object_internals_t *priv = vlc_internals( p_this );
     int fd = -1;
 
-    vlc_thread_cancel( p_this );
     vlc_mutex_lock( &pipe_lock );
     if( !p_this->b_die )
     {
@@ -797,7 +792,7 @@ static vlc_object_t *FindChildName (vlc_object_internals_t *priv,
 static void PrintObject( vlc_object_internals_t *priv,
                          const char *psz_prefix )
 {
-    char psz_refcount[20], psz_thread[30], psz_name[50], psz_parent[20];
+    char psz_refcount[20], psz_name[50], psz_parent[20];
 
     int canc = vlc_savecancel ();
     memset( &psz_name, 0, sizeof(psz_name) );
@@ -815,20 +810,15 @@ static void PrintObject( vlc_object_internals_t *priv,
     if( priv->i_refcount > 0 )
         snprintf( psz_refcount, 19, ", %u refs", priv->i_refcount );
 
-    psz_thread[0] = '\0';
-    if( priv->b_thread )
-        snprintf( psz_thread, 29, " (thread %lu)",
-                  (unsigned long)priv->thread_id );
-
     psz_parent[0] = '\0';
     /* FIXME: need structure lock!!! */
     if( vlc_externals(priv)->p_parent )
         snprintf( psz_parent, 19, ", parent %p",
                   vlc_externals(priv)->p_parent );
 
-    printf( " %so %p %s%s%s%s%s\n", psz_prefix,
+    printf( " %so %p %s%s%s%s\n", psz_prefix,
             vlc_externals(priv), vlc_externals(priv)->psz_object_type,
-            psz_name, psz_thread, psz_refcount, psz_parent );
+            psz_name, psz_refcount, psz_parent );
     vlc_restorecancel (canc);
 }
 
diff --git a/src/misc/threads.c b/src/misc/threads.c
index 8888a01..9b3d5c1 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -30,91 +30,7 @@
 #endif
 
 #include <vlc_common.h>
-
-#include "libvlc.h"
 #include <assert.h>
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if defined( LIBVLC_USE_PTHREAD )
-# include <sched.h>
-#endif
-
-struct vlc_thread_boot
-{
-    void * (*entry) (vlc_object_t *);
-    vlc_object_t *object;
-};
-
-static void *thread_entry (void *data)
-{
-    vlc_object_t *obj = ((struct vlc_thread_boot *)data)->object;
-    void *(*func) (vlc_object_t *) = ((struct vlc_thread_boot *)data)->entry;
-
-    free (data);
-    msg_Dbg (obj, "thread started");
-    func (obj);
-    msg_Dbg (obj, "thread ended");
-
-    return NULL;
-}
-
-#undef vlc_thread_create
-/*****************************************************************************
- * vlc_thread_create: create a thread
- *****************************************************************************
- * Note that i_priority is only taken into account on platforms supporting
- * userland real-time priority threads.
- *****************************************************************************/
-int vlc_thread_create( vlc_object_t *p_this, void *(*func) ( vlc_object_t * ),
-                       int i_priority )
-{
-    int i_ret;
-    vlc_object_internals_t *p_priv = vlc_internals( p_this );
-
-    struct vlc_thread_boot *boot = malloc (sizeof (*boot));
-    if (boot == NULL)
-        return errno;
-    boot->entry = func;
-    boot->object = p_this;
-
-    /* Make sure we don't re-create a thread if the object has already one */
-    assert( !p_priv->b_thread );
-
-    i_ret = vlc_clone( &p_priv->thread_id, thread_entry, boot, i_priority );
-    if( i_ret == 0 )
-        p_priv->b_thread = true;
-    else
-    {
-        errno = i_ret;
-        msg_Err( p_this, "cannot create thread (%m)" );
-        free (boot);
-    }
-
-    return i_ret;
-}
-
-#undef vlc_thread_join
-/*****************************************************************************
- * vlc_thread_join: wait until a thread exits, inner version
- *****************************************************************************/
-void vlc_thread_join( vlc_object_t *p_this )
-{
-    vlc_object_internals_t *p_priv = vlc_internals( p_this );
-
-    vlc_join( p_priv->thread_id, NULL );
-    p_priv->b_thread = false;
-}
-
-void vlc_thread_cancel (vlc_object_t *obj)
-{
-    vlc_object_internals_t *priv = vlc_internals (obj);
-
-    if (priv->b_thread)
-        vlc_cancel (priv->thread_id);
-}
 
 /*** Global locks ***/
 



More information about the vlc-commits mailing list