Commit f6c0a1a1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

libvlccore: remove the threads count

Nowadays, it can only deadlock (threads>0) or do nothing (threads==0)
parent 0bb7a50e
...@@ -233,10 +233,6 @@ libvlc_int_t * libvlc_InternalCreate( void ) ...@@ -233,10 +233,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
vlc_mutex_init( &priv->timer_lock ); vlc_mutex_init( &priv->timer_lock );
vlc_mutex_init( &priv->config_lock ); vlc_mutex_init( &priv->config_lock );
priv->threads_count = 0;
vlc_mutex_init (&priv->threads_lock);
vlc_cond_init (NULL, &priv->threads_wait);
/* Store data for the non-reentrant API */ /* Store data for the non-reentrant API */
p_static_vlc = p_libvlc; p_static_vlc = p_libvlc;
...@@ -1032,17 +1028,6 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) ...@@ -1032,17 +1028,6 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
} }
#endif #endif
/* Make sure all threads are completed before we start looking for
* reference leaks and deinitializing core LibVLC subsytems. */
vlc_mutex_lock (&priv->threads_lock);
while (priv->threads_count)
{
msg_Dbg (p_libvlc, "waiting for %u remaining threads",
priv->threads_count);
vlc_cond_wait (&priv->threads_wait, &priv->threads_lock);
}
vlc_mutex_unlock (&priv->threads_lock);
bool b_clean = true; bool b_clean = true;
FOREACH_ARRAY( input_item_t *p_del, priv->input_items ) FOREACH_ARRAY( input_item_t *p_del, priv->input_items )
msg_Err( p_libvlc, "input item %p has not been deleted properly: refcount %d, name %s", msg_Err( p_libvlc, "input item %p has not been deleted properly: refcount %d, name %s",
...@@ -1122,8 +1107,6 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc ) ...@@ -1122,8 +1107,6 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
/* Destroy mutexes */ /* Destroy mutexes */
vlc_mutex_destroy( &priv->config_lock ); vlc_mutex_destroy( &priv->config_lock );
vlc_mutex_destroy( &priv->timer_lock ); vlc_mutex_destroy( &priv->timer_lock );
vlc_cond_destroy (&priv->threads_wait);
vlc_mutex_destroy (&priv->threads_lock);
vlc_object_release( p_libvlc ); vlc_object_release( p_libvlc );
p_libvlc = NULL; p_libvlc = NULL;
......
...@@ -256,11 +256,6 @@ typedef struct libvlc_priv_t ...@@ -256,11 +256,6 @@ typedef struct libvlc_priv_t
/* Private playlist data (FIXME - playlist_t is too public...) */ /* Private playlist data (FIXME - playlist_t is too public...) */
sout_instance_t *p_sout; ///< kept sout instance (for playlist) sout_instance_t *p_sout; ///< kept sout instance (for playlist)
/* Thread support */
unsigned threads_count;
vlc_mutex_t threads_lock;
vlc_cond_t threads_wait;
} libvlc_priv_t; } libvlc_priv_t;
static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc) static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
......
...@@ -480,7 +480,6 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line ...@@ -480,7 +480,6 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
{ {
int i_ret; int i_ret;
vlc_object_internals_t *p_priv = vlc_internals( p_this ); vlc_object_internals_t *p_priv = vlc_internals( p_this );
libvlc_priv_t *libpriv = libvlc_priv (p_this->p_libvlc);
struct vlc_thread_boot *boot = malloc (sizeof (*boot)); struct vlc_thread_boot *boot = malloc (sizeof (*boot));
if (boot == NULL) if (boot == NULL)
...@@ -488,10 +487,6 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line ...@@ -488,10 +487,6 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
boot->entry = func; boot->entry = func;
boot->object = p_this; boot->object = p_this;
vlc_mutex_lock (&libpriv->threads_lock);
libpriv->threads_count++;
vlc_mutex_unlock (&libpriv->threads_lock);
vlc_object_lock( p_this ); vlc_object_lock( p_this );
/* Make sure we don't re-create a thread if the object has already one */ /* Make sure we don't re-create a thread if the object has already one */
...@@ -598,14 +593,6 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line ...@@ -598,14 +593,6 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
} }
vlc_object_unlock( p_this ); vlc_object_unlock( p_this );
if (i_ret)
{
vlc_mutex_lock (&libpriv->threads_lock);
if (--libpriv->threads_count == 0)
vlc_cond_signal (&libpriv->threads_wait);
vlc_mutex_unlock (&libpriv->threads_lock);
}
return i_ret; return i_ret;
} }
...@@ -766,19 +753,8 @@ error: ...@@ -766,19 +753,8 @@ error:
(unsigned long)p_priv->thread_id, psz_file, i_line ); (unsigned long)p_priv->thread_id, psz_file, i_line );
} }
else else
{
libvlc_priv_t *libpriv = libvlc_priv (p_this->p_libvlc);
msg_Dbg( p_this, "thread %lu joined (%s:%d)", msg_Dbg( p_this, "thread %lu joined (%s:%d)",
(unsigned long)p_priv->thread_id, psz_file, i_line ); (unsigned long)p_priv->thread_id, psz_file, i_line );
vlc_mutex_lock (&libpriv->threads_lock);
#ifndef NDEBUG
libpriv->threads_count--;
#else
if (--libpriv->threads_count == 0)
#endif
vlc_cond_signal (&libpriv->threads_wait);
vlc_mutex_unlock (&libpriv->threads_lock);
}
p_priv->b_thread = false; p_priv->b_thread = false;
} }
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