[vlc-devel] commit: Use OSAtomic() as a fallback on Mac OS X. (Pierre d'Herbemont )
git version control
git at videolan.org
Sat Sep 20 01:08:40 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Fri Sep 19 23:59:26 2008 +0200| [16903a1bbb9a15e718f3c63daa2b7972b9f83dc6] | committer: Pierre d'Herbemont
Use OSAtomic() as a fallback on Mac OS X.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=16903a1bbb9a15e718f3c63daa2b7972b9f83dc6
---
po/Makefile.in.in | 2 --
src/libvlc.c | 10 ++++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
index 13256d8..fecf500 100644
--- a/po/Makefile.in.in
+++ b/po/Makefile.in.in
@@ -166,8 +166,6 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
--msgid-bugs-address="$$msgid_bugs_address" \
;; \
esac
- sed 's/&/\&/' $(DOMAIN).po > $(DOMAIN).po1 && \
- mv $(DOMAIN).po1 $(DOMAIN).po;
test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
diff --git a/src/libvlc.c b/src/libvlc.c
index b67cf89..07e25d3 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -98,6 +98,10 @@
#include <vlc_vlm.h>
+#ifdef __APPLE__
+# include <libkern/OSAtomic.h>
+#endif
+
#include <assert.h>
/*****************************************************************************
@@ -127,6 +131,8 @@ void *vlc_gc_init (gc_object_t *p_gc, void (*pf_destruct) (gc_object_t *))
p_gc->refs = 1;
#ifdef USE_SYNC
__sync_synchronize ();
+#elif defined(__APPLE__)
+ OSMemoryBarrier ();
#else
/* Nobody else can possibly lock the spin - it's there as a barrier */
vlc_spin_init (&p_gc->spin);
@@ -148,6 +154,8 @@ void *vlc_hold (gc_object_t * p_gc)
#ifdef USE_SYNC
refs = __sync_fetch_and_add (&p_gc->refs, 1);
+#elif defined(__APPLE__)
+ OSAtomicIncrement32Barrier((int*)&p_gc->refs);
#else
vlc_spin_lock (&p_gc->spin);
refs = p_gc->refs++;
@@ -169,6 +177,8 @@ void vlc_release (gc_object_t *p_gc)
#ifdef USE_SYNC
refs = __sync_fetch_and_sub (&p_gc->refs, 1);
+#elif defined(__APPLE__)
+ OSAtomicDecrement32Barrier((int*)&p_gc->refs);
#else
vlc_spin_lock (&p_gc->spin);
refs = p_gc->refs--;
More information about the vlc-devel
mailing list