[vlc-devel] commit: vlc_cond_broadcast: broadcast signal on a condition variable ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Sep 7 18:06:23 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Sep 7 18:25:01 2008 +0300| [f8d586c21c3f438634c52805d92028e47bcc43d0] | committer: Rémi Denis-Courmont
vlc_cond_broadcast: broadcast signal on a condition variable
Seems like this is needed for proper vlc_object_kill() (if more than
one thread waits on a given object).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f8d586c21c3f438634c52805d92028e47bcc43d0
---
include/vlc_threads.h | 1 +
src/libvlccore.sym | 1 +
src/misc/threads.c | 17 +++++++++++++++++
3 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index c61f6a9..fcebdeb 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -135,6 +135,7 @@ VLC_EXPORT( int, vlc_mutex_init_recursive, ( vlc_mutex_t * ) );
VLC_EXPORT( void, __vlc_mutex_destroy, ( const char *, int, vlc_mutex_t * ) );
VLC_EXPORT( int, vlc_cond_init, ( vlc_cond_t * ) );
VLC_EXPORT( void, __vlc_cond_destroy, ( const char *, int, vlc_cond_t * ) );
+VLC_EXPORT( void, vlc_cond_broadcast, (vlc_cond_t *) );
VLC_EXPORT( int, vlc_threadvar_create, (vlc_threadvar_t * , void (*) (void *) ) );
VLC_EXPORT( void, vlc_threadvar_delete, (vlc_threadvar_t *) );
VLC_EXPORT( int, __vlc_thread_create, ( vlc_object_t *, const char *, int, const char *, void * ( * ) ( vlc_object_t * ), int, bool ) );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index ce8944e..3622c86 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -426,6 +426,7 @@ VLC_CompileBy
VLC_CompileDomain
VLC_CompileHost
VLC_Compiler
+vlc_cond_broadcast
__vlc_cond_destroy
vlc_cond_init
vlc_config_create
diff --git a/src/misc/threads.c b/src/misc/threads.c
index 03b31f4..8858cec 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -8,6 +8,7 @@
* Samuel Hocevar <sam at zoy.org>
* Gildas Bazin <gbazin at netcourrier.com>
* Clément Sténac
+ * Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -373,6 +374,22 @@ void __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condva
#endif
}
+/**
+ * Wakes up all threads (if any) waiting on a condition variable.
+ * @param p_cond condition variable
+ */
+void vlc_cond_broadcast (vlc_cond_t *p_condvar)
+{
+#if defined (LIBVLC_USE_PTHREAD)
+ pthread_cond_broadcast (p_condvar);
+
+#elif defined (WIN32)
+ SetEvent (*p_condvar);
+
+#endif
+}
+
+
/*****************************************************************************
* vlc_tls_create: create a thread-local variable
*****************************************************************************/
More information about the vlc-devel
mailing list