Browse Source

* wait for some started threads to terminate when we fail to create
more, hopefully more robust that waiting an arbitrary amount of
time in between
* replaced calls to tthread.resume with calls tthread.start

git-svn-id: trunk@27624 -

Jonas Maebe 11 years ago
parent
commit
01d63b376e
1 changed files with 11 additions and 7 deletions
  1. 11 7
      tests/webtbs/tw10815.pp

+ 11 - 7
tests/webtbs/tw10815.pp

@@ -55,17 +55,21 @@ begin
      try
        Inc(ThreadNumber);
        thr:=ThProva.Create(Threadnumber);
-       thr.resume;
+       thr.start;
      Except on e: Exception do
        begin
-         WriteLn(e.Message);
-         halt(1);
+         { maybe the previously started threads didn't finish yet -> give them some
+           more time to completely terminate }
+         sleep(1000);
+         try
+           thr:=ThProva.Create(Threadnumber);
+           thr.start;
+         except
+           WriteLn(e.Message);
+           halt(1);
+         end;
        end;
      end;
-     if (threadnumber mod 16) = 0 then
-       while (threadsfinished<>threadnumber) do
-         { let the started threads to finish }
-         sleep(70);
    end;
   while (threadsfinished<>threadnumber) do
     { give some time to the started threads to finish }