示例#1
0
    void AtomicRefCount::reset()
    {
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
      ::InterlockedExchange( (volatile LONG*)&m_count, (volatile LONG)0 );
#elif defined( __APPLE__ )
      OSAtomicAnd32Barrier( (uint32_t)0, (volatile uint32_t*)&m_count );
#elif defined( HAVE_GCC_ATOMIC_BUILTINS )
      // Use the gcc intrinsic for atomic decrement if supported.
      __sync_fetch_and_and( &m_count, 0 );
#else
      // Fallback to using a lock
      MutexGuard m( m_lock );
      m_count = 0;
#endif
    }
示例#2
0
uint32_t __sync_and_and_fetch_4 (uint32_t *ptr, int32_t value, ...)
{
    return OSAtomicAnd32Barrier(value, ptr);
}