Commit f818952f authored by Laurent Aimar's avatar Laurent Aimar

Used vlc_clone for interface threads.

parent 0984b220
...@@ -52,6 +52,7 @@ typedef struct intf_thread_t ...@@ -52,6 +52,7 @@ typedef struct intf_thread_t
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */ struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
vlc_thread_t thread; /** LibVLC thread */
/* Thread properties and locks */ /* Thread properties and locks */
#if defined( __APPLE__ ) #if defined( __APPLE__ )
bool b_should_run_on_first_thread; bool b_should_run_on_first_thread;
......
...@@ -132,8 +132,8 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module ) ...@@ -132,8 +132,8 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module )
* (it needs access to the main thread) */ * (it needs access to the main thread) */
if( p_intf->b_should_run_on_first_thread ) if( p_intf->b_should_run_on_first_thread )
{ {
if( vlc_thread_create( p_intf, MonitorLibVLCDeath, if( vlc_clone( &p_intf->thread,
VLC_THREAD_PRIORITY_LOW ) ) MonitorLibVLCDeath, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{ {
msg_Err( p_intf, "cannot spawn libvlc death monitoring thread" ); msg_Err( p_intf, "cannot spawn libvlc death monitoring thread" );
vlc_mutex_unlock( &lock ); vlc_mutex_unlock( &lock );
...@@ -144,13 +144,15 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module ) ...@@ -144,13 +144,15 @@ int intf_Create( vlc_object_t *p_this, const char *psz_module )
/* It is monitoring libvlc, not the p_intf */ /* It is monitoring libvlc, not the p_intf */
vlc_object_kill( p_intf->p_libvlc ); vlc_object_kill( p_intf->p_libvlc );
vlc_join( p_intf->thread, NULL );
} }
else else
#endif #endif
/* Run the interface in a separate thread */ /* Run the interface in a separate thread */
if( p_intf->pf_run if( p_intf->pf_run
&& vlc_thread_create( p_intf, RunInterface, && vlc_clone( &p_intf->thread,
VLC_THREAD_PRIORITY_LOW ) ) RunInterface, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{ {
msg_Err( p_intf, "cannot spawn interface thread" ); msg_Err( p_intf, "cannot spawn interface thread" );
vlc_mutex_unlock( &lock ); vlc_mutex_unlock( &lock );
...@@ -198,7 +200,7 @@ void intf_DestroyAll( libvlc_int_t *p_libvlc ) ...@@ -198,7 +200,7 @@ void intf_DestroyAll( libvlc_int_t *p_libvlc )
intf_thread_t *p_next = p_intf->p_next; intf_thread_t *p_next = p_intf->p_next;
if( p_intf->pf_run ) if( p_intf->pf_run )
vlc_thread_join( p_intf ); vlc_join( p_intf->thread, NULL );
module_unneed( p_intf, p_intf->p_module ); module_unneed( p_intf, p_intf->p_module );
free( p_intf->psz_intf ); free( p_intf->psz_intf );
config_ChainDestroy( p_intf->p_cfg ); config_ChainDestroy( p_intf->p_cfg );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment