Commit 16903a1b authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Use OSAtomic() as a fallback on Mac OS X.

parent 129582fb
...@@ -166,8 +166,6 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed ...@@ -166,8 +166,6 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
--msgid-bugs-address="$$msgid_bugs_address" \ --msgid-bugs-address="$$msgid_bugs_address" \
;; \ ;; \
esac esac
sed 's/&/\&/' $(DOMAIN).po > $(DOMAIN).po1 && \
mv $(DOMAIN).po1 $(DOMAIN).po;
test ! -f $(DOMAIN).po || { \ test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot; then \ if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
......
...@@ -98,6 +98,10 @@ ...@@ -98,6 +98,10 @@
#include <vlc_vlm.h> #include <vlc_vlm.h>
#ifdef __APPLE__
# include <libkern/OSAtomic.h>
#endif
#include <assert.h> #include <assert.h>
/***************************************************************************** /*****************************************************************************
...@@ -127,6 +131,8 @@ void *vlc_gc_init (gc_object_t *p_gc, void (*pf_destruct) (gc_object_t *)) ...@@ -127,6 +131,8 @@ void *vlc_gc_init (gc_object_t *p_gc, void (*pf_destruct) (gc_object_t *))
p_gc->refs = 1; p_gc->refs = 1;
#ifdef USE_SYNC #ifdef USE_SYNC
__sync_synchronize (); __sync_synchronize ();
#elif defined(__APPLE__)
OSMemoryBarrier ();
#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 */
vlc_spin_init (&p_gc->spin); vlc_spin_init (&p_gc->spin);
...@@ -148,6 +154,8 @@ void *vlc_hold (gc_object_t * p_gc) ...@@ -148,6 +154,8 @@ void *vlc_hold (gc_object_t * p_gc)
#ifdef USE_SYNC #ifdef USE_SYNC
refs = __sync_fetch_and_add (&p_gc->refs, 1); refs = __sync_fetch_and_add (&p_gc->refs, 1);
#elif defined(__APPLE__)
OSAtomicIncrement32Barrier((int*)&p_gc->refs);
#else #else
vlc_spin_lock (&p_gc->spin); vlc_spin_lock (&p_gc->spin);
refs = p_gc->refs++; refs = p_gc->refs++;
...@@ -169,6 +177,8 @@ void vlc_release (gc_object_t *p_gc) ...@@ -169,6 +177,8 @@ void vlc_release (gc_object_t *p_gc)
#ifdef USE_SYNC #ifdef USE_SYNC
refs = __sync_fetch_and_sub (&p_gc->refs, 1); refs = __sync_fetch_and_sub (&p_gc->refs, 1);
#elif defined(__APPLE__)
OSAtomicDecrement32Barrier((int*)&p_gc->refs);
#else #else
vlc_spin_lock (&p_gc->spin); vlc_spin_lock (&p_gc->spin);
refs = p_gc->refs--; refs = p_gc->refs--;
......
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