mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 18:25:58 +02:00
* made return value of TInterfacedObject._AddRef and
TInterfacedObject._Release thread safe git-svn-id: trunk@6130 -
This commit is contained in:
parent
7298005e0b
commit
3eb4823209
@ -715,20 +715,15 @@
|
|||||||
function TInterfacedObject._AddRef : longint;stdcall;
|
function TInterfacedObject._AddRef : longint;stdcall;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inclocked(frefcount);
|
_addref:=interlockedincrement(frefcount);
|
||||||
_addref:=frefcount;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TInterfacedObject._Release : longint;stdcall;
|
function TInterfacedObject._Release : longint;stdcall;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if declocked(frefcount) then
|
_Release:=interlockeddecrement(frefcount);
|
||||||
begin
|
if _Release=0 then
|
||||||
self.destroy;
|
self.destroy;
|
||||||
_Release:=0;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
_Release:=frefcount;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TInterfacedObject.AfterConstruction;
|
procedure TInterfacedObject.AfterConstruction;
|
||||||
|
Loading…
Reference in New Issue
Block a user