mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:29:16 +02:00
* fixed tinterlockedmt*.pp for architectures with weak memory consistency
models git-svn-id: trunk@41164 -
This commit is contained in:
parent
85f1b78162
commit
56fd8e1208
@ -208,6 +208,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ ensure the writes to Counter and Counter2 are ordered vs the writes to FinishedCount }
|
||||||
|
WriteBarrier;
|
||||||
InterLockedIncrement64(FinishedCount);
|
InterLockedIncrement64(FinishedCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -293,6 +295,10 @@ begin
|
|||||||
if t = 0 then
|
if t = 0 then
|
||||||
t:=1/MSecsPerDay;
|
t:=1/MSecsPerDay;
|
||||||
|
|
||||||
|
{ ensure the read from FinishedCount above is ordered relative to the reads from
|
||||||
|
Counter and Counter2 (counterpart to WriteBarrier in the thread function) }
|
||||||
|
ReadBarrier();
|
||||||
|
|
||||||
CheckResult(Counter, 0, 20, 'Counter error:');
|
CheckResult(Counter, 0, 20, 'Counter error:');
|
||||||
|
|
||||||
CheckResult(Counter2, (LastCompareVal - 2)*CmpCount, 21, 'Counter2 error:');
|
CheckResult(Counter2, (LastCompareVal - 2)*CmpCount, 21, 'Counter2 error:');
|
||||||
|
@ -204,6 +204,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ ensure the writes to Counter and Counter2 are ordered vs the writes to FinishedCount }
|
||||||
|
WriteBarrier;
|
||||||
|
|
||||||
InterLockedIncrement(FinishedCount);
|
InterLockedIncrement(FinishedCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -288,6 +291,10 @@ begin
|
|||||||
if t = 0 then
|
if t = 0 then
|
||||||
t:=1/MSecsPerDay;
|
t:=1/MSecsPerDay;
|
||||||
|
|
||||||
|
{ ensure the read from FinishedCount above is ordered relative to the reads from
|
||||||
|
Counter and Counter2 (counterpart to WriteBarrier in the thread function) }
|
||||||
|
ReadBarrier();
|
||||||
|
|
||||||
CheckResult(Counter, 0, 20, 'Counter error:');
|
CheckResult(Counter, 0, 20, 'Counter error:');
|
||||||
|
|
||||||
CheckResult(Counter2, (LastCompareVal - 2)*CmpCount, 21, 'Counter2 error:');
|
CheckResult(Counter2, (LastCompareVal - 2)*CmpCount, 21, 'Counter2 error:');
|
||||||
|
Loading…
Reference in New Issue
Block a user