[vlc-commits] Used vlc_clone for interface threads.
Laurent Aimar
git at videolan.org
Mon May 23 21:16:29 CEST 2011
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon May 23 20:46:43 2011 +0200| [f818952f2af10abf7efbff8510276cae66d99a08] | committer: Laurent Aimar
Used vlc_clone for interface threads.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f818952f2af10abf7efbff8510276cae66d99a08
---
include/vlc_interface.h | 1 +
src/interface/interface.c | 12 +++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index 6ad89bf..9e0dd8f 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -52,6 +52,7 @@ typedef struct intf_thread_t
VLC_COMMON_MEMBERS
struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
+ vlc_thread_t thread; /** LibVLC thread */
/* Thread properties and locks */
#if defined( __APPLE__ )
bool b_should_run_on_first_thread;
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 4fddf41..7682aad 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -132,8 +132,8 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module )
* (it needs access to the main thread) */
if( p_intf->b_should_run_on_first_thread )
{
- if( vlc_thread_create( p_intf, MonitorLibVLCDeath,
- VLC_THREAD_PRIORITY_LOW ) )
+ if( vlc_clone( &p_intf->thread,
+ MonitorLibVLCDeath, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{
msg_Err( p_intf, "cannot spawn libvlc death monitoring thread" );
vlc_mutex_unlock( &lock );
@@ -144,13 +144,15 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module )
/* It is monitoring libvlc, not the p_intf */
vlc_object_kill( p_intf->p_libvlc );
+
+ vlc_join( p_intf->thread, NULL );
}
else
#endif
/* Run the interface in a separate thread */
if( p_intf->pf_run
- && vlc_thread_create( p_intf, RunInterface,
- VLC_THREAD_PRIORITY_LOW ) )
+ && vlc_clone( &p_intf->thread,
+ RunInterface, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{
msg_Err( p_intf, "cannot spawn interface thread" );
vlc_mutex_unlock( &lock );
@@ -198,7 +200,7 @@ void intf_DestroyAll( libvlc_int_t *p_libvlc )
intf_thread_t *p_next = p_intf->p_next;
if( p_intf->pf_run )
- vlc_thread_join( p_intf );
+ vlc_join( p_intf->thread, NULL );
module_unneed( p_intf, p_intf->p_module );
free( p_intf->psz_intf );
config_ChainDestroy( p_intf->p_cfg );
More information about the vlc-commits
mailing list