[vlc-commits] Removed vlc_thread_set_priority().

Laurent Aimar git at videolan.org
Mon May 23 21:16:29 CEST 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon May 23 20:29:52 2011 +0200| [0984b22055c88b1222c85c942fdd19b41270d861] | committer: Laurent Aimar

Removed vlc_thread_set_priority().

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

 src/input/input.c  |    2 +-
 src/libvlc.h       |    3 --
 src/misc/threads.c |   59 ----------------------------------------------------
 3 files changed, 1 insertions(+), 63 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 8e16682..2150907 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1292,7 +1292,7 @@ static int Init( input_thread_t * p_input )
         {
             /* We don't want a high input priority here or we'll
              * end-up sucking up all the CPU time */
-            vlc_thread_set_priority( p_input, VLC_THREAD_PRIORITY_LOW );
+            vlc_set_priority( p_input->p->thread, VLC_THREAD_PRIORITY_LOW );
         }
 
         msg_Dbg( p_input, "starting in %s mode",
diff --git a/src/libvlc.h b/src/libvlc.h
index 34c44db..75db8f0 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -51,13 +51,10 @@ 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;
-int vlc_thread_set_priority( vlc_object_t *, int ) 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) )
-#define vlc_thread_set_priority( P_THIS, PRIORITY )                         \
-    vlc_thread_set_priority( VLC_OBJECT(P_THIS), PRIORITY )
 
 void vlc_thread_cancel (vlc_object_t *);
 int vlc_object_waitpipe (vlc_object_t *obj);
diff --git a/src/misc/threads.c b/src/misc/threads.c
index 265f60b..8888a01 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -96,65 +96,6 @@ int vlc_thread_create( vlc_object_t *p_this, void *(*func) ( vlc_object_t * ),
     return i_ret;
 }
 
-#undef vlc_thread_set_priority
-/*****************************************************************************
- * vlc_thread_set_priority: set the priority of the current thread when we
- * couldn't set it in vlc_thread_create (for instance for the main thread)
- *****************************************************************************/
-int vlc_thread_set_priority( vlc_object_t *p_this, int i_priority )
-{
-    vlc_object_internals_t *p_priv = vlc_internals( p_this );
-
-    if( !p_priv->b_thread )
-    {
-        msg_Err( p_this, "couldn't set priority of non-existent thread" );
-        return ESRCH;
-    }
-
-#if defined( LIBVLC_USE_PTHREAD )
-# ifndef __APPLE__
-    if( var_InheritBool( p_this, "rt-priority" ) )
-# endif
-    {
-        int i_error, i_policy;
-        struct sched_param param;
-
-        memset( &param, 0, sizeof(struct sched_param) );
-        if( config_GetType( p_this, "rt-offset" ) )
-            i_priority += var_InheritInteger( p_this, "rt-offset" );
-        if( i_priority <= 0 )
-        {
-            param.sched_priority = (-1) * i_priority;
-            i_policy = SCHED_OTHER;
-        }
-        else
-        {
-            param.sched_priority = i_priority;
-            i_policy = SCHED_RR;
-        }
-        if( (i_error = pthread_setschedparam( p_priv->thread_id,
-                                              i_policy, &param )) )
-        {
-            errno = i_error;
-            msg_Warn( p_this, "cannot set thread priority (%m)" );
-            i_priority = 0;
-        }
-    }
-
-#elif defined( WIN32 ) || defined( UNDER_CE )
-
-#warning vlc_thread_set_priority() is BROKEN
-    if( true /*!SetThreadPriority(p_priv->thread_id->id, i_priority)*/ )
-    {
-        msg_Warn( p_this, "couldn't set a faster priority" );
-        return 1;
-    }
-
-#endif
-
-    return 0;
-}
-
 #undef vlc_thread_join
 /*****************************************************************************
  * vlc_thread_join: wait until a thread exits, inner version



More information about the vlc-commits mailing list