[vlc-devel] commit: Avoid huge CPU comsumption when rc and --daemon are use at the same time ( Christophe Mutricy )

git version control git at videolan.org
Mon Mar 31 21:22:56 CEST 2008


vlc | branch: 0.8.6-bugfix | Christophe Mutricy <xtophe at videolan.org> | Mon Mar 31 20:19:59 2008 +0100| [c37341f13f0d0a7ef847a9caf1688d01882627ce]

Avoid huge CPU comsumption when rc and --daemon are use at the same time

Patch by Bertrand Marquis aka bma on Launchpad (LP#104698)
Refs #986

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

 modules/control/rc.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/control/rc.c b/modules/control/rc.c
index 3ad9247..28c85db 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -141,8 +141,12 @@ void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
 
     if( p_intf->p_sys->i_socket == -1 )
     {
-        utf8_vfprintf( stdout, psz_fmt, args );
-        printf( "\r\n" );
+        if (!config_GetInt( p_intf, "rc-fake-tty" ))
+        {
+            utf8_vfprintf( stdout, psz_fmt, args );
+            printf( "\r\n" );
+        }
+
     }
     else
     {
@@ -2297,6 +2301,12 @@ vlc_bool_t ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
     }
 #endif
 
+   if (p_intf->p_sys->i_socket == -1 && config_GetInt( p_intf, "rc-fake-tty" ))
+   {
+        msleep( INTF_IDLE_SLEEP );
+        return VLC_FALSE;
+   }
+
     while( !p_intf->b_die && *pi_size < MAX_LINE_LENGTH &&
            (i_read = net_ReadNonBlock( p_intf, p_intf->p_sys->i_socket == -1 ?
                        0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL,




More information about the vlc-devel mailing list