[haiku-development] Re: BWeakReferenceable

  • From: Philippe Houdoin <philippe.houdoin@xxxxxxxxx>
  • To: haiku-development <haiku-development@xxxxxxxxxxxxx>
  • Date: Thu, 22 Sep 2011 12:52:04 +0200

Hi Clemens,

>        void SetTo(const BWeakReference<Type>& other)
>        {
>                Unset();
>
>                if (other.fPointer) {
>                        fPointer = other.fPointer;
>                        fPointer->AcquireReference();
>                }
>        }

I'm not sure, but I smell that a possible race condition could be
avoided if AcquireReference() is done *before* the assignent?
Ignore my remark if it's a plain stupid one :-)

Bye,
  Philippe.

Other related posts: