* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.133 2004/02/11 19:17:13 fenrir Exp $
+ * $Id: libvlc.h,v 1.134 2004/02/20 17:20:01 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
"slow. You should only activate this if you know what you're " \
"doing.")
+#define RT_OFFSET_TEXT N_("Adjust VLC priority")
+#define RT_OFFSET_LONGTEXT N_( \
+ "This options adds an offset (positive or negative) to VLC default " \
+ "priorities. You can use it to tune VLC priority against other " \
+ "programs, or against other VLC instances.")
+
#define MINIMIZE_THREADS_TXT N_("Minimize number of threads")
#define MINIMIZE_THREADS_LONGTXT N_( \
"This option minimizes the number of threads needed to run VLC")
add_bool( "rt-priority", 0, NULL, RT_PRIORITY_TEXT, RT_PRIORITY_LONGTEXT, VLC_TRUE );
#endif
+#if !defined(SYS_BEOS) && defined(PTHREAD_COND_T_IN_PTHREAD_H)
+ add_integer( "rt-offset", 0, NULL, RT_OFFSET_TEXT, RT_OFFSET_LONGTEXT, VLC_TRUE );
+#endif
+
#if defined(WIN32)
add_bool( "one-instance", 0, NULL, ONEINSTANCE_TEXT, ONEINSTANCE_LONGTEXT, VLC_TRUE );
add_bool( "high-priority", 1, NULL, HPRIORITY_TEXT, HPRIORITY_LONGTEXT, VLC_TRUE );
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999-2004 VideoLAN
- * $Id: threads.c,v 1.45 2004/01/06 12:02:06 zorglub Exp $
+ * $Id: threads.c,v 1.46 2004/02/20 17:20:01 massiot Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
{
int i_error, i_policy;
struct sched_param param;
+
memset( ¶m, 0, sizeof(struct sched_param) );
+ i_priority += config_GetInt( p_this, "rt-offset" );
if ( i_priority < 0 )
{
param.sched_priority = (-1) * i_priority;
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
-
-#ifdef SYS_DARWIN
- if ( i_priority )
+ if ( i_priority
+#ifndef SYS_DARWIN
+ && config_GetInt( p_this, "rt-priority" )
+#endif
+ )
{
int i_error, i_policy;
struct sched_param param;
+
memset( ¶m, 0, sizeof(struct sched_param) );
+ i_priority += config_GetInt( p_this, "rt-offset" );
if ( i_priority < 0 )
{
param.sched_priority = (-1) * i_priority;
param.sched_priority = i_priority;
i_policy = SCHED_RR;
}
- if ( (i_error = pthread_setschedparam( pthread_self(),
+ if ( (i_error = pthread_setschedparam( p_this->thread_id,
i_policy, ¶m )) )
{
msg_Warn( p_this, "couldn't set thread priority (%s:%d): %s",
i_priority = 0;
}
}
-#endif
-
#endif
return 0;