-#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 )
-{
-#if defined(LIBVLC_USE_PTHREAD)
-# define vlc_assert_locked( m ) \
- assert (pthread_mutex_lock (m) == EDEADLK)
- int val = pthread_mutex_lock( p_mutex );
- VLC_THREAD_ASSERT ("locking mutex");
-
-#elif defined( UNDER_CE )
- (void)psz_file; (void)i_line;
-
- EnterCriticalSection( &p_mutex->csection );
-
-#elif defined( WIN32 )
- (void)psz_file; (void)i_line;
-
- WaitForSingleObject( *p_mutex, INFINITE );
-
-#elif defined( SYS_BEOS )
- acquire_sem( p_mutex->lock );
-
-#endif
-}
-
-#ifndef vlc_assert_locked
-# define vlc_assert_locked( m ) (void)m
-#endif
-
-/*****************************************************************************
- * vlc_mutex_unlock: unlock a mutex
- *****************************************************************************/
-#define vlc_mutex_unlock( P_MUTEX ) \
- __vlc_mutex_unlock( __FILE__, __LINE__, P_MUTEX )
-
-static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
- vlc_mutex_t *p_mutex )
-{
-#if defined(LIBVLC_USE_PTHREAD)
- int val = pthread_mutex_unlock( p_mutex );
- VLC_THREAD_ASSERT ("unlocking mutex");
-
-#elif defined( UNDER_CE )
- (void)psz_file; (void)i_line;
-
- LeaveCriticalSection( &p_mutex->csection );
-
-#elif defined( WIN32 )
- (void)psz_file; (void)i_line;
-
- ReleaseMutex( *p_mutex );
-
-#elif defined( SYS_BEOS )
- release_sem( p_mutex->lock );
-
-#endif
-}
-
-/*****************************************************************************
- * vlc_mutex_destroy: destroy a mutex
- *****************************************************************************/
-#define vlc_mutex_destroy( P_MUTEX ) \
- __vlc_mutex_destroy( __FILE__, __LINE__, P_MUTEX )
-
-/**
- * Save the cancellation state and disable cancellation for the calling thread.
- * This function must be called before entering a piece of code that is not
- * cancellation-safe.
- * @return Previous cancellation state (opaque value).
- */
-static inline int vlc_savecancel (void)
-{
- int state;
-#if defined (LIBVLC_USE_PTHREAD)
- (void) pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
-#else
- vlc_control_cancel (VLC_SAVE_CANCEL, &state);
-#endif
- return state;
-}
-
-/**
- * Restore the cancellation state for the calling thread.
- * @param state previous state as returned by vlc_savecancel().
- * @return Nothing, always succeeds.
- */
-static inline void vlc_restorecancel (int state)
-{
-#if defined (LIBVLC_USE_PTHREAD)
- (void) pthread_setcancelstate (state, NULL);
-#else
- vlc_control_cancel (VLC_RESTORE_CANCEL, state);
-#endif
-}
-
-/**
- * Issues an explicit deferred cancellation point.
- * This has no effect if thread cancellation is disabled.
- * This can be called when there is a rather slow non-sleeping operation.
- */
-static inline void vlc_testcancel (void)
-{
-#if defined (LIBVLC_USE_PTHREAD)
- pthread_testcancel ();
-#else
- vlc_control_cancel (VLC_TEST_CANCEL);
-#endif
-}