Commit 4b4f77c3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

var_GetGlobalMutex() creates and gets a global mutex

parent 0df4f0cd
......@@ -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.
*/
......
......@@ -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
......
......@@ -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
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment