[vlc-devel] commit: interaction: safely join the thread ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jul 5 14:02:15 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jul  5 15:04:10 2008 +0300| [d2ff9ebf3b5c789711a83777986b1d07261afd67]

interaction: safely join the thread

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

 src/interface/interaction.c |   10 ++++++++++
 src/interface/interface.h   |    2 +-
 src/libvlc.c                |    2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/interface/interaction.c b/src/interface/interaction.c
index 59a4f0f..6eab001 100644
--- a/src/interface/interaction.c
+++ b/src/interface/interaction.c
@@ -388,6 +388,16 @@ interaction_t * interaction_Init( libvlc_int_t *p_libvlc )
     return p_interaction;
 }
 
+void interaction_Destroy( interaction_t *p_interaction )
+{
+    if( !p_interaction )
+        return;
+
+    vlc_object_kill( p_interaction );
+    vlc_thread_join( p_interaction );
+    vlc_object_release( p_interaction );
+}
+
 /**********************************************************************
  * The following functions are local
  **********************************************************************/
diff --git a/src/interface/interface.h b/src/interface/interface.h
index 82530d9..6401ccd 100644
--- a/src/interface/interface.h
+++ b/src/interface/interface.h
@@ -34,7 +34,7 @@
  * Interaction
  **********************************************************************/
 
-/* release via vlc_object_release() */
 interaction_t * interaction_Init( libvlc_int_t *p_libvlc );
+void interaction_Destroy( interaction_t * );
 
 #endif
diff --git a/src/libvlc.c b/src/libvlc.c
index 1e62c1f..73eed93 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -964,7 +964,7 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
 
     /* Free interaction */
     msg_Dbg( p_libvlc, "removing interaction" );
-    vlc_object_release( priv->p_interaction );
+    interaction_Destroy( priv->p_interaction );
 
     /* Free video outputs */
     msg_Dbg( p_libvlc, "removing all video outputs" );




More information about the vlc-devel mailing list