Max 5 API Reference
00001 // ext_atomic.h copyright 2008 cycling '74 00002 00003 #ifndef __EXT_ATOMIC_H__ 00004 #define __EXT_ATOMIC_H__ 00005 00006 #ifdef MAC_VERSION 00007 00008 #include <libkern/OSAtomic.h> 00009 typedef int t_int32_atomic; 00010 00011 #define ATOMIC_INCREMENT(pv) OSAtomicIncrement32(pv) 00012 #define ATOMIC_DECREMENT(pv) OSAtomicDecrement32(pv) 00013 00014 #else // WIN_VERSION 00015 00016 #include <intrin.h> 00017 typedef volatile long t_int32_atomic; 00018 00019 #pragma intrinsic (_InterlockedIncrement) 00020 #pragma intrinsic (_InterlockedDecrement) 00021 00022 /** Use this routine for incrementing a global counter using a threadsafe and multiprocessor safe method. 00023 @ingroup threading 00024 @param pv pointer to the (int) counter. 00025 */ 00026 #define ATOMIC_INCREMENT(pv) (_InterlockedIncrement(pv)) 00027 00028 00029 /** Use this routine for decrementing a global counter using a threadsafe and multiprocessor safe method. 00030 @ingroup threading 00031 @param pv pointer to the (int) counter. 00032 */ 00033 #define ATOMIC_DECREMENT(pv) (_InterlockedDecrement(pv)) 00034 00035 #endif // WIN_VERSION 00036 00037 00038 #endif // __EXT_ATOMIC_H__
Copyright © 2008, Cycling '74