vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Nov 10 20:51:26 2012 +0200| [9575a2e2a7e2f21550da4c77bf54e34fc3e402b7] | committer: Rémi Denis-Courmont
Remove spin lock functions This was not a particularly good idea in user space. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9575a2e2a7e2f21550da4c77bf54e34fc3e402b7 --- include/vlc_threads.h | 74 ------------------------------------------------- 1 file changed, 74 deletions(-) diff --git a/include/vlc_threads.h b/include/vlc_threads.h index 0ae5252..7c6a4ca 100644 --- a/include/vlc_threads.h +++ b/include/vlc_threads.h @@ -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. _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
