The atomic operation require that range and overflow checks are disabled

This commit is contained in:
Pierre Muller 2025-05-25 05:16:18 +00:00
parent a58def8baa
commit c64dc1f97e

View File

@ -14,6 +14,14 @@ uses
{$endif unix}
SysUtils, Classes;
{$ifopt R+}
{$define DISABLE_R_LOCALLY}
{$endif}
{$ifopt Q+}
{$define DISABLE_Q_LOCALLY}
{$endif}
type
TOperation = (opAdd, opDec, opAdd7, opDec7, opExchange, opExchangeAdd, opExchangeDec, opCompareExchange);
@ -66,6 +74,8 @@ begin
AtomicIncrement(WorkingCount);
Sleep(10);
{$ifdef DISABLE_R_LOCALLY} {$R-} {$endif}
{$ifdef DISABLE_Q_LOCALLY} {$Q-} {$endif}
case FOp of
opAdd:
begin
@ -162,6 +172,8 @@ begin
end;
end;
{$ifdef DISABLE_R_LOCALLY} {$R+} {$endif}
{$ifdef DISABLE_Q_LOCALLY} {$Q+} {$endif}
{ ensure the writes to Counter and Counter2 are ordered vs the writes to FinishedCount }
WriteBarrier;