]> git.sesse.net Git - vlc/commitdiff
vlc_cond_broadcast: broadcast signal on a condition variable
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 7 Sep 2008 15:25:01 +0000 (18:25 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 7 Sep 2008 15:59:27 +0000 (18:59 +0300)
Seems like this is needed for proper vlc_object_kill() (if more than
one thread waits on a given object).

include/vlc_threads.h
src/libvlccore.sym
src/misc/threads.c

index c61f6a91c9c317b6a2ee55b97f0a71e77373afab..fcebdeb6117d384813a396c7da423f052f088edc 100644 (file)
@@ -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 ) );
index ce8944ed85686f892da9726724bd59a18a2b3b51..3622c868a7b4feb6e76f16648854607bb02f799e 100644 (file)
@@ -426,6 +426,7 @@ VLC_CompileBy
 VLC_CompileDomain
 VLC_CompileHost
 VLC_Compiler
+vlc_cond_broadcast
 __vlc_cond_destroy
 vlc_cond_init
 vlc_config_create
index 03b31f4c0b5fd37d280e5c9f6f5137c013f1155a..8858cec8b72364cdde441c023eb18e44faeb193f 100644 (file)
@@ -8,6 +8,7 @@
  *          Samuel Hocevar <sam@zoy.org>
  *          Gildas Bazin <gbazin@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
  *****************************************************************************/