瀏覽代碼

* 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;