[vlc-devel] commit: Decrease thread count after join rather than before exit ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu Aug 14 21:17:43 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Aug 12 20:18:07 2008 +0300| [3f202d2e6dd26ce4867e19921ab7585fa779c096] | committer: Rémi Denis-Courmont
Decrease thread count after join rather than before exit
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f202d2e6dd26ce4867e19921ab7585fa779c096
---
src/misc/threads.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/misc/threads.c b/src/misc/threads.c
index 06e85a3..36947ea 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -465,15 +465,6 @@ static THREAD_RTYPE thread_entry (void *data)
func (obj);
msg_Dbg (obj, "thread ended");
- libvlc_priv_t *libpriv = libvlc_priv (obj->p_libvlc);
- 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);
return THREAD_RVAL;
}
@@ -775,8 +766,19 @@ error:
(unsigned long)p_priv->thread_id, psz_file, i_line );
}
else
+ {
+ libvlc_priv_t *libpriv = libvlc_priv (p_this->p_libvlc);
msg_Dbg( p_this, "thread %lu joined (%s:%d)",
(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;
}
More information about the vlc-devel
mailing list