14 #include "atomicrefcount.h"
18 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
20 #elif defined( __APPLE__ )
21 # include <libkern/OSAtomic.h>
22 #elif defined( HAVE_GCC_ATOMIC_BUILTINS )
25 # include "mutexguard.h"
44 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
45 return (
int) ::InterlockedIncrement( (
volatile LONG*)&m_count );
46 #elif defined( __APPLE__ )
47 return (
int) OSAtomicIncrement32Barrier( (
volatile int32_t*)&m_count );
48 #elif defined( HAVE_GCC_ATOMIC_BUILTINS )
50 return static_cast<int>( __sync_add_and_fetch( &m_count, 1 ) );
60 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
61 return (
int) ::InterlockedDecrement( (
volatile LONG*)&m_count );
62 #elif defined( __APPLE__ )
63 return (
int) OSAtomicDecrement32Barrier( (
volatile int32_t*)&m_count );
64 #elif defined( HAVE_GCC_ATOMIC_BUILTINS )
66 return static_cast<int>( __sync_sub_and_fetch( &m_count, 1 ) );
76 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
77 ::InterlockedExchange( (
volatile LONG*)&m_count, (
volatile LONG)0 );
78 #elif defined( __APPLE__ )
79 OSAtomicAnd32Barrier( (uint32_t)0, (
volatile uint32_t*)&m_count );
80 #elif defined( HAVE_GCC_ATOMIC_BUILTINS )
82 __sync_fetch_and_and( &m_count, 0 );
A simple implementation of a mutex guard.
The namespace for the gloox library.