Преглед изворни кода

* made the test threadsafe :)

Jonas Maebe пре 23 година
родитељ
комит
1144e7ccce
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      tests/test/tmt1.pp

+ 3 - 1
tests/test/tmt1.pp

@@ -3,6 +3,8 @@
 {$mode objfpc}
 {$threading on}
 
+uses sysutils;
+
 const
    threadcount = 100;
    stringlen = 10000;
@@ -23,7 +25,7 @@ function f(p : pointer) : longint;
         inc(thri);
       end;
      writeln('thread ',longint(p),' finished');
-     inc(finished);
+     InterLockedIncrement(finished);
      f:=0;
   end;