mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 14:29:14 +02:00
The atomic operation require that range and overflow checks are disabled
This commit is contained in:
parent
a58def8baa
commit
c64dc1f97e
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user