문제

#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); }
};

[This is the basis of an invasive refcounted pointer; I just want to make sure the refcounts are not off]

올바른 솔루션이 없습니다

다른 팁

It looks OK from here. There are many public examples you can use (such as counter_t from the Adobe Source Libraries) to futher improve upon your implementation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top