Commit 360eeee3 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

libvlc: only use sync_ on GGCs that have it.

This fixes [d635ae4e]
parent fa79d12d
...@@ -76,6 +76,12 @@ ...@@ -76,6 +76,12 @@
# include <hal/libhal.h> # include <hal/libhal.h>
#endif #endif
#if defined(__GNUC__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 0)
#define USE_SYNC
#endif
#endif
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_interface.h> #include <vlc_interface.h>
...@@ -119,7 +125,7 @@ void *vlc_gc_init (gc_object_t *p_gc, void (*pf_destruct) (gc_object_t *)) ...@@ -119,7 +125,7 @@ void *vlc_gc_init (gc_object_t *p_gc, void (*pf_destruct) (gc_object_t *))
p_gc->pf_destructor = pf_destruct; p_gc->pf_destructor = pf_destruct;
p_gc->refs = 1; p_gc->refs = 1;
#ifdef __GNUC__ #ifdef USE_SYNC
__sync_synchronize (); __sync_synchronize ();
#else #else
/* Nobody else can possibly lock the spin - it's there as a barrier */ /* Nobody else can possibly lock the spin - it's there as a barrier */
...@@ -140,7 +146,7 @@ void *vlc_hold (gc_object_t * p_gc) ...@@ -140,7 +146,7 @@ void *vlc_hold (gc_object_t * p_gc)
uintptr_t refs; uintptr_t refs;
assert( p_gc ); assert( p_gc );
#ifdef __GNUC__ #ifdef USE_SYNC
refs = __sync_fetch_and_add (&p_gc->refs, 1); refs = __sync_fetch_and_add (&p_gc->refs, 1);
#else #else
vlc_spin_lock (&p_gc->spin); vlc_spin_lock (&p_gc->spin);
...@@ -161,7 +167,7 @@ void vlc_release (gc_object_t *p_gc) ...@@ -161,7 +167,7 @@ void vlc_release (gc_object_t *p_gc)
assert( p_gc ); assert( p_gc );
#ifdef __GNUC__ #ifdef USE_SYNC
refs = __sync_fetch_and_sub (&p_gc->refs, 1); refs = __sync_fetch_and_sub (&p_gc->refs, 1);
#else #else
vlc_spin_lock (&p_gc->spin); vlc_spin_lock (&p_gc->spin);
......
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