From: RĂ©mi Denis-Courmont Date: Thu, 16 Aug 2007 16:51:49 +0000 (+0000) Subject: var_GetGlobalMutex() creates and gets a global mutex X-Git-Tag: 0.9.0-test0~6502 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4b4f77c3c14aae4afdb589529333b92838b0e9f8;p=vlc var_GetGlobalMutex() creates and gets a global mutex --- diff --git a/include/vlc_variables.h b/include/vlc_variables.h index fedaaad20b..71365c6a27 100644 --- a/include/vlc_variables.h +++ b/include/vlc_variables.h @@ -126,6 +126,8 @@ VLC_EXPORT( void, __var_OptionParse, ( vlc_object_t *, const char * ) ); #define var_Command(a,b,c,d,e) __var_Command( VLC_OBJECT( a ), b, c, d, e ) VLC_EXPORT( int, __var_Command, ( vlc_object_t *, const char *, const char *, const char *, char ** ) ); +VLC_EXPORT( vlc_mutex_t *, var_GetGlobalMutex, ( const char * ) ); + /** * __var_Create() with automatic casting. */ diff --git a/src/libvlc.sym b/src/libvlc.sym index 75ec636225..23610fa120 100644 --- a/src/libvlc.sym +++ b/src/libvlc.sym @@ -342,6 +342,7 @@ __var_Create __var_DelCallback __var_Destroy __var_Get +var_GetGlobalMutex __var_OptionParse __var_Set __var_Type @@ -362,7 +363,6 @@ VLC_VariableSet __vlc_cond_destroy __vlc_cond_init vlc_current_object -vlc_global_object vlc_error VLC_Error __vlc_execve diff --git a/src/misc/variables.c b/src/misc/variables.c index 8abba518c4..a20d3359e5 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -828,6 +828,23 @@ int __var_Get( vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val ) return VLC_SUCCESS; } + +/** + * Gets a process-wide mutex, creates it if needed. + */ +vlc_mutex_t *var_GetGlobalMutex( const char *name ) +{ + libvlc_global_data_t *p_global = vlc_global_object(); + vlc_value_t val; + + if( var_Create( p_global, name, VLC_VAR_MUTEX ) ) + return NULL; + + var_Get( p_global, &val ); + return val.p_lockval; +} + + /** * Register a callback in a variable *