* fixed tinterlockedmt*.pp for architectures with weak memory consistency

models

git-svn-id: trunk@41164 -
This commit is contained in:
Jonas Maebe 2019-02-02 14:28:48 +00:00
parent 85f1b78162
commit 56fd8e1208
2 changed files with 13 additions and 0 deletions

View File

@ -208,6 +208,8 @@ begin
end;
end;
{ ensure the writes to Counter and Counter2 are ordered vs the writes to FinishedCount }
WriteBarrier;
InterLockedIncrement64(FinishedCount);
end;
@ -293,6 +295,10 @@ begin
if t = 0 then
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(Counter2, (LastCompareVal - 2)*CmpCount, 21, 'Counter2 error:');

View File

@ -204,6 +204,9 @@ begin
end;
end;
{ ensure the writes to Counter and Counter2 are ordered vs the writes to FinishedCount }
WriteBarrier;
InterLockedIncrement(FinishedCount);
end;
@ -288,6 +291,10 @@ begin
if t = 0 then
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(Counter2, (LastCompareVal - 2)*CmpCount, 21, 'Counter2 error:');