]> git.sesse.net Git - vlc/commitdiff
* Made rt-priority a real-time variable (shut-up sam) and misc attempts
authorChristophe Massiot <massiot@videolan.org>
Tue, 4 Mar 2003 23:36:57 +0000 (23:36 +0000)
committerChristophe Massiot <massiot@videolan.org>
Tue, 4 Mar 2003 23:36:57 +0000 (23:36 +0000)
  to improve responsiveness under OS X

modules/gui/macosx/intf.m
src/libvlc.c
src/libvlc.h
src/misc/threads.c

index 7980833faeadd2f183ad401c456ba0bcdf9bb36a..7348f86fcf54006020242ccc052d24ab0eb70d39 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * 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>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -402,7 +402,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
 
     [NSTimer scheduledTimerWithTimeInterval: 0.5
         target: self selector: @selector(manageIntf:)
-        userInfo: nil repeats: TRUE];
+        userInfo: nil repeats: FALSE];
 
     [NSThread detachNewThreadSelector: @selector(manage)
         toTarget: self withObject: nil];
@@ -767,6 +767,10 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
     vlc_object_release( p_playlist );
 
     [self updateMessageArray];
+
+    [NSTimer scheduledTimerWithTimeInterval: 0.5
+        target: self selector: @selector(manageIntf:)
+        userInfo: nil repeats: FALSE];
 }
 
 - (void)updateMessageArray
index 211b8920291b57be211e3e56b22b7b1a48757b49..e57535f170ec291e9c4b8c41dc650e4841404060 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.c: main libvlc source
  *****************************************************************************
  * 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>
  *          Samuel Hocevar <sam@zoy.org>
@@ -138,7 +138,6 @@ int VLC_Create( void )
     {
         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
      * at least we have var_Create */
@@ -183,6 +182,7 @@ int VLC_Create( void )
     {
         return VLC_EGENERIC;
     }
+    vlc_thread_set_priority( p_vlc, VLC_THREAD_PRIORITY_LOW );
 
     p_vlc->psz_object_name = "root";
 
index a4370c3e68745ba4b146bdef77d1a4629ce70539..8b79aad84d8c1227240b350909585db9cebf7a56 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * 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>
  *          Samuel Hocevar <sam@zoy.org>
@@ -576,6 +576,10 @@ vlc_module_begin();
     add_integer( "win9x-cv-method", 0, NULL, WIN9X_CV_TEXT, WIN9X_CV_LONGTEXT, VLC_TRUE );
 #endif
 
+#if defined(SYS_DARWIN)
+    add_integer( "rt-priority", 1, NULL, NULL, NULL, VLC_TRUE );
+#endif
+
     /* Usage (mainly useful for cmd line stuff) */
     add_usage_hint( PLAYLIST_USAGE );
 
index 939e5f306b4ebdb53c204bc7a17a5b14efe162b2..2f6605b4eaafbac730b5652c4b4e0a3d5798f587 100644 (file)
@@ -2,7 +2,7 @@
  * threads.c : threads implementation for the VideoLAN client
  *****************************************************************************
  * 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>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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 )
     i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data );
 
+#ifdef SYS_DARWIN
     if ( i_priority )
     {
         int i_error;
         struct sched_param 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,
                                                SCHED_RR, &param )) )
         {
@@ -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 )
     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,
     }
 
 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
+
+#ifdef SYS_DARWIN
     if ( i_priority )
     {
         int i_error;
         struct sched_param 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(),
                                                SCHED_RR, &param )) )
         {
@@ -710,6 +714,7 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file,
             i_priority = 0;
         }
     }
+#endif
 
 #endif