2
#define atomicAdd OSAtomicAdd32Barrier
class PtrInterface: public Uncopyable {
private:
typedef volatile int RefCount;
mutable RefCount rc;
public:
inline void newRef() const { atomicAdd(1, &rc); }
inline void deleteRef() const { atomicAdd(-1, &rc); }
};
[這是入侵指針的基礎;我只是想確保refcounts不是]在多核MacOSX上,是以下C++代碼線程安全嗎?