|Subject:||Is this thread-safe?|
|Posted by:||Arno Garrels (firstname.lastname@example.org)|
|Date:||Sat, 22 Jun 2013|
function TObject.__ObjRelease: Integer;
Result := AtomicDecrement(FRefCount) and not objDisposedFlag;
if Result = 0 then
if __SetDisposed(Self) then
Well, AtomicDecrement actually is, however what follows after
AtomicDecrement returned zero is not. If after AtomicDecrement
returned zero another thread would increment the reference count
we got a nice little dangling pointer.
Or am I missing something?