]> git.sesse.net Git - vlc/commitdiff
WIN32 rc-quiet fix, only do net_Accept once per second to avoid loading down CPU
authorMark Moriarty <markfm@videolan.org>
Sun, 17 Oct 2004 23:32:46 +0000 (23:32 +0000)
committerMark Moriarty <markfm@videolan.org>
Sun, 17 Oct 2004 23:32:46 +0000 (23:32 +0000)
modules/control/rc.c

index c0b56331777dab36b04af1ad5ce5b567beec48d9..8351a5a0b007a02e99429eb2f404cc110a22938e 100644 (file)
@@ -388,13 +388,33 @@ static void Run( intf_thread_t *p_intf )
     {
         char *psz_cmd, *psz_arg;
         vlc_bool_t b_complete;
-
+        
         if( p_intf->p_sys->i_socket_listen != - 1 &&
-            p_intf->p_sys->i_socket == -1 )
+               p_intf->p_sys->i_socket == -1 )
         {
+#ifdef WIN32
+            /* If rc-quiet is specified, only check for socket connections
+               once per second, to not flood the CPU.  */
+               if( config_GetInt( p_intf, "rc-quiet" ) )
+               {
+                do
+                {
+                    p_intf->p_sys->i_socket =
+                        net_Accept( p_intf, p_intf->p_sys->i_socket_listen, 0 );
+                    msleep( 1000 );
+                } while  ( p_intf->p_sys->i_socket == -1 );
+            }
+            else
+            {
+                p_intf->p_sys->i_socket =
+                    net_Accept( p_intf, p_intf->p_sys->i_socket_listen, 0 );
+               }
+#else
             p_intf->p_sys->i_socket =
                 net_Accept( p_intf, p_intf->p_sys->i_socket_listen, 0 );
+#endif        
         }
 
         b_complete = ReadCommand( p_intf, p_buffer, &i_size );