Commit 9575a2e2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove spin lock functions

This was not a particularly good idea in user space.
parent 51a26d08
......@@ -411,80 +411,6 @@ static inline void vlc_cleanup_lock (void *lock)
}
#define mutex_cleanup_push( lock ) vlc_cleanup_push (vlc_cleanup_lock, lock)
#if defined (_POSIX_SPIN_LOCKS) && ((_POSIX_SPIN_LOCKS - 0) > 0)
typedef pthread_spinlock_t vlc_spinlock_t;
/**
* Initializes a spinlock.
*/
static inline void vlc_spin_init (vlc_spinlock_t *spin)
{
if (pthread_spin_init (spin, PTHREAD_PROCESS_PRIVATE))
abort ();
}
/**
* Acquires a spinlock.
*/
static inline void vlc_spin_lock (vlc_spinlock_t *spin)
{
pthread_spin_lock (spin);
}
/**
* Releases a spinlock.
*/
static inline void vlc_spin_unlock (vlc_spinlock_t *spin)
{
pthread_spin_unlock (spin);
}
/**
* Deinitializes a spinlock.
*/
static inline void vlc_spin_destroy (vlc_spinlock_t *spin)
{
pthread_spin_destroy (spin);
}
#elif defined (WIN32)
typedef CRITICAL_SECTION vlc_spinlock_t;
static inline void vlc_spin_init (vlc_spinlock_t *spin)
{
if (!InitializeCriticalSectionAndSpinCount(spin, 4000))
abort ();
}
static inline void vlc_spin_lock (vlc_spinlock_t *spin)
{
EnterCriticalSection(spin);
}
static inline void vlc_spin_unlock (vlc_spinlock_t *spin)
{
LeaveCriticalSection(spin);
}
static inline void vlc_spin_destroy (vlc_spinlock_t *spin)
{
DeleteCriticalSection(spin);
}
#else
/* Fallback to plain mutexes if spinlocks are not available */
typedef vlc_mutex_t vlc_spinlock_t;
static inline void vlc_spin_init (vlc_spinlock_t *spin)
{
vlc_mutex_init (spin);
}
# define vlc_spin_lock vlc_mutex_lock
# define vlc_spin_unlock vlc_mutex_unlock
# define vlc_spin_destroy vlc_mutex_destroy
#endif
#ifdef __cplusplus
/**
* Helper C++ class to lock a mutex.
......
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