Commit b3793e34 authored by Christophe Massiot's avatar Christophe Massiot

* Made rt-priority a real-time variable (shut-up sam) and misc attempts

  to improve responsiveness under OS X
parent 514f5dff
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.64 2003/03/04 22:36:18 hartman Exp $ * $Id: intf.m,v 1.65 2003/03/04 23:36:57 massiot Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -402,7 +402,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) ...@@ -402,7 +402,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
[NSTimer scheduledTimerWithTimeInterval: 0.5 [NSTimer scheduledTimerWithTimeInterval: 0.5
target: self selector: @selector(manageIntf:) target: self selector: @selector(manageIntf:)
userInfo: nil repeats: TRUE]; userInfo: nil repeats: FALSE];
[NSThread detachNewThreadSelector: @selector(manage) [NSThread detachNewThreadSelector: @selector(manage)
toTarget: self withObject: nil]; toTarget: self withObject: nil];
...@@ -767,6 +767,10 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) ...@@ -767,6 +767,10 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
[self updateMessageArray]; [self updateMessageArray];
[NSTimer scheduledTimerWithTimeInterval: 0.5
target: self selector: @selector(manageIntf:)
userInfo: nil repeats: FALSE];
} }
- (void)updateMessageArray - (void)updateMessageArray
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.69 2003/03/03 14:21:08 gbazin Exp $ * $Id: libvlc.c,v 1.70 2003/03/04 23:36:57 massiot Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -138,7 +138,6 @@ int VLC_Create( void ) ...@@ -138,7 +138,6 @@ int VLC_Create( void )
{ {
return i_ret; return i_ret;
} }
vlc_thread_set_priority( p_vlc, VLC_THREAD_PRIORITY_LOW );
/* Now that the thread system is initialized, we don't have much, but /* Now that the thread system is initialized, we don't have much, but
* at least we have var_Create */ * at least we have var_Create */
...@@ -183,6 +182,7 @@ int VLC_Create( void ) ...@@ -183,6 +182,7 @@ int VLC_Create( void )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
vlc_thread_set_priority( p_vlc, VLC_THREAD_PRIORITY_LOW );
p_vlc->psz_object_name = "root"; p_vlc->psz_object_name = "root";
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header * libvlc.h: main libvlc header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.45 2003/02/20 16:07:38 gbazin Exp $ * $Id: libvlc.h,v 1.46 2003/03/04 23:36:57 massiot Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -576,6 +576,10 @@ vlc_module_begin(); ...@@ -576,6 +576,10 @@ vlc_module_begin();
add_integer( "win9x-cv-method", 0, NULL, WIN9X_CV_TEXT, WIN9X_CV_LONGTEXT, VLC_TRUE ); add_integer( "win9x-cv-method", 0, NULL, WIN9X_CV_TEXT, WIN9X_CV_LONGTEXT, VLC_TRUE );
#endif #endif
#if defined(SYS_DARWIN)
add_integer( "rt-priority", 1, NULL, NULL, NULL, VLC_TRUE );
#endif
/* Usage (mainly useful for cmd line stuff) */ /* Usage (mainly useful for cmd line stuff) */
add_usage_hint( PLAYLIST_USAGE ); add_usage_hint( PLAYLIST_USAGE );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client * threads.c : threads implementation for the VideoLAN client
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: threads.c,v 1.38 2003/03/02 01:35:30 gbazin Exp $ * $Id: threads.c,v 1.39 2003/03/04 23:36:57 massiot Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -611,12 +611,13 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, ...@@ -611,12 +611,13 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data ); i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data );
#ifdef SYS_DARWIN
if ( i_priority ) if ( i_priority )
{ {
int i_error; int i_error;
struct sched_param param; struct sched_param param;
memset( &param, 0, sizeof(struct sched_param) ); memset( &param, 0, sizeof(struct sched_param) );
param.sched_priority = i_priority; param.sched_priority = config_GetInt( p_this, "rt-priority" );
if ( (i_error = pthread_setschedparam( p_this->thread_id, if ( (i_error = pthread_setschedparam( p_this->thread_id,
SCHED_RR, &param )) ) SCHED_RR, &param )) )
{ {
...@@ -626,6 +627,7 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line, ...@@ -626,6 +627,7 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
} }
} }
#endif
#elif defined( HAVE_CTHREADS_H ) #elif defined( HAVE_CTHREADS_H )
p_this->thread_id = cthread_fork( (cthread_fn_t)func, (any_t)p_data ); p_this->thread_id = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
...@@ -696,12 +698,14 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file, ...@@ -696,12 +698,14 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file,
} }
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
#ifdef SYS_DARWIN
if ( i_priority ) if ( i_priority )
{ {
int i_error; int i_error;
struct sched_param param; struct sched_param param;
memset( &param, 0, sizeof(struct sched_param) ); memset( &param, 0, sizeof(struct sched_param) );
param.sched_priority = i_priority; param.sched_priority = config_GetInt( p_this, "rt-priority" );
if ( (i_error = pthread_setschedparam( pthread_self(), if ( (i_error = pthread_setschedparam( pthread_self(),
SCHED_RR, &param )) ) SCHED_RR, &param )) )
{ {
...@@ -710,6 +714,7 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file, ...@@ -710,6 +714,7 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file,
i_priority = 0; i_priority = 0;
} }
} }
#endif
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment