+#if defined( WIN32 ) && !defined ETIMEDOUT
+# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
+#endif
+
+/*****************************************************************************
+ * Function definitions
+ *****************************************************************************/
+VLC_EXPORT( int, vlc_mutex_init, ( vlc_mutex_t * ) );
+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( 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 * ( * ) ( void * ), int, bool ) );
+VLC_EXPORT( int, __vlc_thread_set_priority, ( vlc_object_t *, const char *, int, int ) );
+VLC_EXPORT( void, __vlc_thread_join, ( vlc_object_t *, const char *, int ) );
+
+#define vlc_thread_ready vlc_object_signal
+
+/*****************************************************************************
+ * vlc_mutex_lock: lock a mutex
+ *****************************************************************************/
+#define vlc_mutex_lock( P_MUTEX ) \
+ __vlc_mutex_lock( __FILE__, __LINE__, P_MUTEX )
+
+VLC_EXPORT(void, vlc_pthread_fatal, (const char *action, int error, const char *file, unsigned line));
+
+#if defined(LIBVLC_USE_PTHREAD)
+# define VLC_THREAD_ASSERT( action ) \
+ if (val) \
+ vlc_pthread_fatal (action, val, psz_file, i_line)
+#else
+# define VLC_THREAD_ASSERT ((void)(val))
+#endif
+
+static inline void __vlc_mutex_lock( const char * psz_file, int i_line,
+ vlc_mutex_t * p_mutex )