[vlc-devel] commit: Remove intf_ShouldDie ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Sep 14 10:11:22 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Sep 14 11:14:24 2008 +0300| [36aca393c55082aab87d0564e225305da24e6e52] | committer: Rémi Denis-Courmont 

Remove intf_ShouldDie

libvlc kills the interfaces when it dies anyway.

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

 include/vlc_interface.h            |    4 ----
 modules/control/gestures.c         |    4 ++--
 modules/control/lirc.c             |    2 +-
 modules/control/netsync.c          |    2 +-
 modules/control/rc.c               |    6 +++---
 modules/control/showintf.c         |    4 ++--
 modules/gui/beos/Interface.cpp     |    2 +-
 modules/gui/fbosd.c                |    2 +-
 modules/gui/ncurses.c              |    2 +-
 modules/gui/pda/pda.c              |    6 +++---
 modules/gui/qt4/main_interface.cpp |    2 +-
 modules/gui/wince/timer.cpp        |    4 ++--
 modules/gui/wxwidgets/timer.cpp    |    2 +-
 13 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index 58b40b8..c24f7b9 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -108,10 +108,6 @@ VLC_EXPORT( intf_thread_t *, __intf_Create,     ( vlc_object_t *, const char * )
 VLC_EXPORT( int,               intf_RunThread,  ( intf_thread_t * ) );
 VLC_EXPORT( void,              intf_StopThread, ( intf_thread_t * ) );
 
-/* If the interface is in the main thread, it should listen both to
- * p_intf->b_die and p_libvlc->b_die */
-#define intf_ShouldDie( p_intf ) (p_intf->b_die || p_intf->p_libvlc->b_die )
-
 #define intf_Eject(a,b) __intf_Eject(VLC_OBJECT(a),b)
 VLC_EXPORT( int, __intf_Eject, ( vlc_object_t *, const char * ) );
 
diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index e849d0d..d0bb029 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -182,7 +182,7 @@ static void RunIntf( intf_thread_t *p_intf )
     msg_Dbg( p_intf, "interface thread initialized" );
 
     /* Main loop */
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );
 
@@ -461,7 +461,7 @@ static int InitThread( intf_thread_t * p_intf )
 {
     char *psz_button;
     /* we might need some locking here */
-    if( !intf_ShouldDie( p_intf ) )
+    if( vlc_object_alive( p_intf ) )
     {
         /* p_intf->change_lock locking strategy:
          * - Every access to p_intf->p_sys are locked threw p_intf->change_lock
diff --git a/modules/control/lirc.c b/modules/control/lirc.c
index 63f4e4f..c82dcc5 100644
--- a/modules/control/lirc.c
+++ b/modules/control/lirc.c
@@ -175,7 +175,7 @@ static int Process( intf_thread_t *p_intf )
         if( code == NULL )
             return 0;
 
-        while( !intf_ShouldDie( p_intf )
+        while( vlc_object_alive( p_intf )
                 && (lirc_code2char( p_intf->p_sys->config, code, &c ) == 0)
                 && (c != NULL) )
         {
diff --git a/modules/control/netsync.c b/modules/control/netsync.c
index 1062548..11f59c7 100644
--- a/modules/control/netsync.c
+++ b/modules/control/netsync.c
@@ -150,7 +150,7 @@ static void Run( intf_thread_t *p_intf )
     /* High priority thread */
     vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_INPUT );
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         /* Update the input */
         if( p_input == NULL )
diff --git a/modules/control/rc.c b/modules/control/rc.c
index ad6150a..448ebf4 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -479,7 +479,7 @@ static void Run( intf_thread_t *p_intf )
     }
 #endif
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         char *psz_cmd, *psz_arg;
         bool b_complete;
@@ -2050,7 +2050,7 @@ bool ReadWin32( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
     while( WaitForSingleObject( p_intf->p_sys->hConsoleIn,
                                 INTF_IDLE_SLEEP/1000 ) == WAIT_OBJECT_0 )
     {
-        while( !intf_ShouldDie( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
+        while( vlc_object_alive( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
                ReadConsoleInput( p_intf->p_sys->hConsoleIn, &input_record,
                                  1, &i_dw ) )
         {
@@ -2120,7 +2120,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
     }
 #endif
 
-    while( !intf_ShouldDie( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
+    while( vlc_object_alive( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
            (i_read = net_Read( p_intf, p_intf->p_sys->i_socket == -1 ?
                        0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL,
                   (uint8_t *)p_buffer + *pi_size, 1, false ) ) > 0 )
diff --git a/modules/control/showintf.c b/modules/control/showintf.c
index d1360df..a59cad6 100644
--- a/modules/control/showintf.c
+++ b/modules/control/showintf.c
@@ -121,7 +121,7 @@ static void RunIntf( intf_thread_t *p_intf )
     }
 
     /* Main loop */
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );
 
@@ -179,7 +179,7 @@ static void RunIntf( intf_thread_t *p_intf )
  *****************************************************************************/
 static int InitThread( intf_thread_t * p_intf )
 {
-    if( !intf_ShouldDie( p_intf ) )
+    if( vlc_object_alive( p_intf ) )
     {
         vlc_mutex_lock( &p_intf->change_lock );
 
diff --git a/modules/gui/beos/Interface.cpp b/modules/gui/beos/Interface.cpp
index 859c618..c1c5f62 100644
--- a/modules/gui/beos/Interface.cpp
+++ b/modules/gui/beos/Interface.cpp
@@ -120,7 +120,7 @@ void CloseIntf ( vlc_object_t *p_this )
  *****************************************************************************/
 static void Run( intf_thread_t *p_intf )
 {
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         p_intf->p_sys->p_window->UpdateInterface();
         msleep( INTF_IDLE_SLEEP );
diff --git a/modules/gui/fbosd.c b/modules/gui/fbosd.c
index 4723fea..ef3de6d 100644
--- a/modules/gui/fbosd.c
+++ b/modules/gui/fbosd.c
@@ -1272,7 +1272,7 @@ static void Run( intf_thread_t *p_intf )
     intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys;
     int canc = vlc_savecancel();
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         int i;
 
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 7b490c0..3ea7a9f 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -404,7 +404,7 @@ static void Run( intf_thread_t *p_intf )
     var_AddCallback( p_playlist, "item-append", PlaylistChanged, p_intf );
     var_AddCallback( p_playlist, "item-change", PlaylistChanged, p_intf );
 
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         msleep( INTF_IDLE_SLEEP );
 
diff --git a/modules/gui/pda/pda.c b/modules/gui/pda/pda.c
index 429a5f1..5776b67 100644
--- a/modules/gui/pda/pda.c
+++ b/modules/gui/pda/pda.c
@@ -317,7 +317,7 @@ static void Run( intf_thread_t *p_intf )
 
 #ifdef NEED_GTK2_MAIN
     msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
-    while( !intf_ShouldDie( p_intf ) )
+    while( vlc_object_alive( p_intf ) )
     {
         Manage( p_intf );
 
@@ -516,14 +516,14 @@ static int Manage( intf_thread_t *p_intf )
         }
         vlc_object_unlock( p_input );
     }
-    else if( p_intf->p_sys->b_playing && !intf_ShouldDie( p_intf ) )
+    else if( p_intf->p_sys->b_playing && vlc_object_alive( p_intf ) )
     {
         GtkModeManage( p_intf );
         p_intf->p_sys->b_playing = 0;
     }
 
 #ifndef NEED_GTK2_MAIN
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 608ff52..764222f 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -924,7 +924,7 @@ void MainInterface::setRate( int rate )
 void MainInterface::updateOnTimer()
 {
     /* No event for dying */
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         QApplication::closeAllWindows();
         QApplication::quit();
diff --git a/modules/gui/wince/timer.cpp b/modules/gui/wince/timer.cpp
index fdacaf5..cdf2acf 100644
--- a/modules/gui/wince/timer.cpp
+++ b/modules/gui/wince/timer.cpp
@@ -210,14 +210,14 @@ void Timer::Notify( void )
             }
         }
     }
-    else if( p_intf->p_sys->b_playing && !intf_ShouldDie( p_intf ) )
+    else if( p_intf->p_sys->b_playing && vlc_object_alive( p_intf ) )
     {
         p_intf->p_sys->b_playing = 0;
         p_main_interface->TogglePlayButton( PAUSE_S );
         i_old_playing_status = PAUSE_S;
     }
 
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 
diff --git a/modules/gui/wxwidgets/timer.cpp b/modules/gui/wxwidgets/timer.cpp
index f65b090..b8e4a2d 100644
--- a/modules/gui/wxwidgets/timer.cpp
+++ b/modules/gui/wxwidgets/timer.cpp
@@ -96,7 +96,7 @@ void Timer::Notify()
         p_intf->p_sys->b_intf_show = false;
     }
 
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 




More information about the vlc-devel mailing list