From: Rémi Denis-Courmont Date: Sun, 7 Sep 2008 15:25:01 +0000 (+0300) Subject: vlc_cond_broadcast: broadcast signal on a condition variable X-Git-Tag: 1.0.0-pre1~3468 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f8d586c21c3f438634c52805d92028e47bcc43d0;p=vlc 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). --- diff --git a/include/vlc_threads.h b/include/vlc_threads.h index c61f6a91c9..fcebdeb611 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 ce8944ed85..3622c868a7 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 03b31f4c0b..8858cec8b7 100644 --- a/src/misc/threads.c +++ b/src/misc/threads.c @@ -8,6 +8,7 @@ * Samuel Hocevar * Gildas Bazin * 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 *****************************************************************************/