Browse Source

* fixed tw4201 after changes from yesterday (when a FInitialSuspended
thread is only resumed when it's terminated no longer executes
the Execute method, and properly terminates the thread)

git-svn-id: trunk@3893 -

Jonas Maebe 19 years ago
parent
commit
8e952b634d
1 changed files with 18 additions and 11 deletions
  1. 18 11
      rtl/darwin/tthread.inc

+ 18 - 11
rtl/darwin/tthread.inc

@@ -146,17 +146,24 @@ begin
   LThread := TThread(parameter);
   WRITE_DEBUG('thread initing, parameter = ', LongInt(LThread));
   try
-    if LThread.FInitialSuspended then begin
-      SemaphoreWait(LThread.FSem);
-      if not LThread.FSuspended then begin
-        LThread.FInitialSuspended := false;
-        WRITE_DEBUG('going into LThread.Execute');
-        LThread.Execute;
-      end;
-    end else begin
-      WRITE_DEBUG('going into LThread.Execute');
-      LThread.Execute;
-    end;
+    if LThread.FInitialSuspended then
+      begin
+        SemaphoreWait(LThread.FSem);
+        if not(LThread.FTerminated) then
+          begin
+            if not LThread.FSuspended then
+              begin
+                LThread.FInitialSuspended := false;
+                WRITE_DEBUG('going into LThread.Execute');
+                LThread.Execute;
+              end;
+          end;
+      end
+     else
+       begin
+         WRITE_DEBUG('going into LThread.Execute');
+         LThread.Execute;
+       end;
   except
     on e: exception do begin
       WRITE_DEBUG('got exception: ',e.message);