Quantcast
Channel: Delphi – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 1440

TInterlocked.Exchange for interfaces?

$
0
0

Via [WayBack] TInterlocked.Exchange for interfaces? Since there is no System.SyncObjs.TInterlocked.Exchange overload for interfaces (and the Exchange versio… – Stefan Glienke – Google+

It has made it to this piece in [Archive.issglienke / Spring4D / source / Source / Reactive / Spring.Reactive.pas — Bitbucket:

class function TInterlockedHelper.Exchange<T>(var Target: T;
  const Value: T): T;
begin
  Result := Default(T);
  PPointer(@Result)^ := Exchange(PPointer(@Target)^, PPointer(@Value)^);
  if Assigned(Value) then
    Value._AddRef;
end;

It is similar to the TInterlocked.Exchange methods.

–jeroen

 


Viewing all articles
Browse latest Browse all 1440

Trending Articles