Browse Source

* added missing write memory barriers

git-svn-id: trunk@44788 -
Jonas Maebe 5 years ago
parent
commit
2355daf63f
1 changed files with 6 additions and 4 deletions
  1. 6 4
      packages/fpmkunit/src/fpmkunit.pp

+ 6 - 4
packages/fpmkunit/src/fpmkunit.pp

@@ -3181,8 +3181,8 @@ begin
     RTLeventWaitFor(FNotifyStartTask,500);
     RTLeventWaitFor(FNotifyStartTask,500);
     if not FDone then
     if not FDone then
       begin
       begin
-      { synchronise with WriteBarrier in mainthread for same reason as above }
-      ReadBarrier;
+      { synchronise with ReadWriteBarrier in mainthread for same reason as above }
+      ReadWriteBarrier;
       FBuildEngine.log(vlInfo,'Compiling: '+APackage.Name);
       FBuildEngine.log(vlInfo,'Compiling: '+APackage.Name);
       FCompilationOK:=false;
       FCompilationOK:=false;
       try
       try
@@ -8182,8 +8182,10 @@ Var
   begin
   begin
     if AThread.Done then
     if AThread.Done then
       begin
       begin
-        { synchronise with the WriteBarrier in the thread }
-        ReadBarrier;
+        { synchronise with the WriteBarrier in the thread (-> ReadBarrier), and prevent
+          any writes we do here afterwards to be reordered before that (so the compile
+          thread won't see these writes either -> also WriteBarrier) }
+        ReadWriteBarrier;
         if assigned(AThread.APackage) then
         if assigned(AThread.APackage) then
           begin
           begin
             // The thread has completed compiling the package
             // The thread has completed compiling the package