#endif
#include <signal.h>
-#define VLC_THREADS_UNINITIALIZED 0
-#define VLC_THREADS_PENDING 1
-#define VLC_THREADS_ERROR 2
-#define VLC_THREADS_READY 3
-
/*****************************************************************************
* Global mutex for lazy initialization of the threads system
*****************************************************************************/
/**
* Global process-wide VLC object.
- * Contains inter-instance data, such as the module cache and global mutexes.
+ * Contains the global named mutexes.
+ * TODO: remove it.
*/
-static libvlc_global_data_t *p_root;
-
-libvlc_global_data_t *vlc_global( void )
-{
- assert( i_initializations > 0 );
- return p_root;
-}
+static vlc_object_t *p_root;
#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
#ifdef __GLIBC__
/* Avoid the strerror_r() prototype brain damage in glibc */
errno = error;
- fprintf (stderr, " Error message: %m at:\n");
+ fprintf (stderr, " Error message: %m\n");
#elif !defined (WIN32)
char buf[1000];
const char *msg;
va_end (ap);
#endif
}
+
+
+#undef var_AcquireMutex
+/**
+ * Finds a process-wide mutex, creates it if needed, and locks it.
+ * Unlock with vlc_mutex_unlock().
+ */
+vlc_mutex_t *var_AcquireMutex( const char *name )
+{
+ vlc_value_t val;
+
+ if( var_Create( p_root, name, VLC_VAR_MUTEX ) )
+ return NULL;
+
+ var_Get( p_root, name, &val );
+ vlc_mutex_lock( val.p_address );
+ return val.p_address;
+}