mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 19:29:26 +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;
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user