Using thread safe SmartPtr

Help
hodoulp
2009-06-09
2013-04-08
  • hodoulp
    hodoulp
    2009-06-09

    Hi,

    Here is the smart pointer I want to use:

    Loki::SmartPtr<T, Loki::COMRefCounted, Loki::DisallowConversion,
                               Loki::NoCheck, Loki::LockedStorage, Loki::PropagateConst>

    My class 'T' has a embedded thread-safe reference counter.

    My goal is to have a thread safe smart pointer.

    However, while checking how Loki handles this, I noticed that the Loki::LockedStorage::Swap is not protected.

    I would have expect a protection to avoid interferences of thread 2 working on smartPtr2 during
    the swap of smartPtr1 & smartPtr2 on thread 1.

    I checked the RefCountedMTAdj and noticed that the Swap is also not protected.

    Can someone explain me why?

    Thanks, Patrick.