From 1818bf1dbc330974c749ca17b4d7b79796587fae Mon Sep 17 00:00:00 2001 From: Jani Monoses Date: Mon, 14 Mar 2011 19:10:04 +0100 Subject: prefer gcc __sync functions over pthread Signed-off-by: Bjoern Michaelsen --- sal/osl/unx/interlck.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sal') diff --git a/sal/osl/unx/interlck.c b/sal/osl/unx/interlck.c index f164371a7..184cb5fee 100644 --- a/sal/osl/unx/interlck.c +++ b/sal/osl/unx/interlck.c @@ -134,7 +134,16 @@ oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* return nCount; } +#elif ( __GNUC__ > 4 ) || (( __GNUC__ == 4) && ( __GNUC_MINOR__ >= 4 )) +oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount) +{ + return __sync_add_and_fetch(pCount, 1); +} +oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount) +{ + return __sync_sub_and_fetch(pCount, 1); +} #else /* use only if nothing else works, expensive due to single mutex for all reference counts */ -- cgit v1.2.3