Explorar el Código

* made the test threadsafe :)

Jonas Maebe hace 23 años
padre
commit
1144e7ccce
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      tests/test/tmt1.pp

+ 3 - 1
tests/test/tmt1.pp

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