Skip to content

Commit

Permalink
TOmniAlignedInt64.Value was already atomic, eh
Browse files Browse the repository at this point in the history
  • Loading branch information
gabr42 committed Feb 28, 2018
1 parent 5439d67 commit 6bfca52
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions OtlCommon.pas
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@
/// Blog : http://thedelphigeek.com
/// Contributors : GJ, Lee_Nover, scarre, Sean B. Durkin
/// Creation date : 2008-06-12
/// Last modification : 2018-02-24
/// Version : 1.49
/// Last modification : 2017-07-26
/// Version : 1.48
///</para><para>
/// History:
/// 1.49: 2018-02-24
/// - Reading/writing TOmniAlignedInt64 is atomic on 32-bit platforms.
/// 1.48: 2017-07-26
/// - TOmniMessageID can now hold TProc<integer>.
/// 1.47: 2017-02-03
Expand Down Expand Up @@ -4673,13 +4671,7 @@ function TOmniAlignedInt64.Decrement(value: int64): int64;

function TOmniAlignedInt64.GetValue: int64;
begin
{$IFDEF CPU64BITS}
Result := Addr^;
{$ELSE}{$IFDEF MSWindows}
Result := DSiInterlockedCompareExchange64(Addr^, 0, 0);
{$ELSE}
Result := TInterlocked.Read(Addr^);
{$ENDIF}{$ENDIF}
end; { TOmniAlignedInt64.GetValue }

function TOmniAlignedInt64.Increment: int64;
Expand All @@ -4702,13 +4694,7 @@ function TOmniAlignedInt64.Increment(value: int64): int64;

procedure TOmniAlignedInt64.SetValue(value: int64);
begin
{$IFDEF CPU64BITS}
Addr^ := value;
{$ELSE}{$IFDEF MSWindows}
DSiInterlockedExchange64(Addr^, value);
{$ELSE}
TInterlocked.Exchange(Addr^, value);
{$ENDIF}{$ENDIF}
end; { TOmniAlignedInt64.SetValue }

{ TOmniIntegerSet }
Expand Down

0 comments on commit 6bfca52

Please # to comment.