* made return value of TInterfacedObject._AddRef and

TInterfacedObject._Release thread safe

git-svn-id: trunk@6130 -
This commit is contained in:
Jonas Maebe 2007-01-22 15:39:55 +00:00
parent 7298005e0b
commit 3eb4823209

View File

@ -715,20 +715,15 @@
function TInterfacedObject._AddRef : longint;stdcall;
begin
inclocked(frefcount);
_addref:=frefcount;
_addref:=interlockedincrement(frefcount);
end;
function TInterfacedObject._Release : longint;stdcall;
begin
if declocked(frefcount) then
begin
self.destroy;
_Release:=0;
end
else
_Release:=frefcount;
_Release:=interlockeddecrement(frefcount);
if _Release=0 then
self.destroy;
end;
procedure TInterfacedObject.AfterConstruction;