Browse Source

* return wrAbandoned rather than wrError from IntbasiceventWaitFor
in case a sleep is interrupted while the event is being destroyed

git-svn-id: trunk@8260 -

Jonas Maebe 18 years ago
parent
commit
ce86cedd4d
1 changed files with 7 additions and 5 deletions
  1. 7 5
      rtl/unix/cthreads.pp

+ 7 - 5
rtl/unix/cthreads.pp

@@ -818,11 +818,13 @@ begin
           { in which case we try to lock once more); 2) an error occurred;    }
           { in which case we try to lock once more); 2) an error occurred;    }
           { 3) we're being destroyed                                          }
           { 3) we're being destroyed                                          }
           until ((nanores=0) and not lastloop) or ((nanores<>0) and (nanoerr<>ESysEINTR)) or plocaleventstate(state)^.FDestroying;
           until ((nanores=0) and not lastloop) or ((nanores<>0) and (nanoerr<>ESysEINTR)) or plocaleventstate(state)^.FDestroying;
-          { adjust result for error or being destroyed }
-          if (nanores <> 0) then
-            result := wrError
-          else if plocaleventstate(state)^.FDestroying then
-            result := wrAbandoned;
+          { adjust result being destroyed or error (in this order, since   }
+          { if we're being destroyed the "error" could be ESysEINTR, which }
+          { is not a real error                                            }
+          if plocaleventstate(state)^.FDestroying then
+            result := wrAbandoned
+          else if (nanores <> 0) then
+            result := wrError;
           { break out of greater loop when we got the lock, when an error }
           { break out of greater loop when we got the lock, when an error }
           { occurred, or when we are being destroyed                      }
           { occurred, or when we are being destroyed                      }
           if (result<>wrTimeOut) then
           if (result<>wrTimeOut) then