- -- If the cond_timedwait returns 0 or EINTR, it is still
- -- possible that the time has actually expired, and by chance
- -- a signal or cond_signal occurred at around the same time.
-
- -- We have also observed that on some OS's the value ETIME
- -- will be returned, but the clock will show that the full delay
- -- has not yet expired.
-
- -- For these reasons, we need to check the clock after return
- -- from cond_timedwait. If the time has expired, we will set
- -- Timedout = True.
-
- -- This check might be omitted for systems on which the
- -- cond_timedwait() never returns early or wakes up spuriously.
-
- -- Annex D requires that completion of a delay cause the task
- -- to go to the end of its priority queue, regardless of whether
- -- the task actually was suspended by the delay. Since
- -- cond_timedwait does not do this on Solaris, we add a call
- -- to thr_yield at the end. We might do this at the beginning,
- -- instead, but then the round-robin effect would not be the
- -- same; the delayed task would be ahead of other tasks of the
- -- same priority that awoke while it was sleeping.
-
- -- For Timed_Sleep, we are expecting possible cond_signals
- -- to indicate other events (e.g., completion of a RV or
- -- completion of the abortable part of an async. select),
- -- we want to always return if interrupted. The caller will
- -- be responsible for checking the task state to see whether
- -- the wakeup was spurious, and to go back to sleep again
- -- in that case. We don't need to check for pending abort
- -- or priority change on the way in our out; that is the
- -- caller's responsibility.
-
- -- For Timed_Delay, we are not expecting any cond_signals or
- -- other interruptions, except for priority changes and aborts.
- -- Therefore, we don't want to return unless the delay has
- -- actually expired, or the call has been aborted. In this
- -- case, since we want to implement the entire delay statement
- -- semantics, we do need to check for pending abort and priority
- -- changes. We can quietly handle priority changes inside the
+ -- If the cond_timedwait returns 0 or EINTR, it is still possible that the
+ -- time has actually expired, and by chance a signal or cond_signal
+ -- occurred at around the same time.
+
+ -- We have also observed that on some OS's the value ETIME will be
+ -- returned, but the clock will show that the full delay has not yet
+ -- expired.
+
+ -- For these reasons, we need to check the clock after return from
+ -- cond_timedwait. If the time has expired, we will set Timedout = True.
+
+ -- This check might be omitted for systems on which the cond_timedwait()
+ -- never returns early or wakes up spuriously.
+
+ -- Annex D requires that completion of a delay cause the task to go to the
+ -- end of its priority queue, regardless of whether the task actually was
+ -- suspended by the delay. Since cond_timedwait does not do this on
+ -- Solaris, we add a call to thr_yield at the end. We might do this at the
+ -- beginning, instead, but then the round-robin effect would not be the
+ -- same; the delayed task would be ahead of other tasks of the same
+ -- priority that awoke while it was sleeping.
+
+ -- For Timed_Sleep, we are expecting possible cond_signals to indicate
+ -- other events (e.g., completion of a RV or completion of the abortable
+ -- part of an async. select), we want to always return if interrupted. The
+ -- caller will be responsible for checking the task state to see whether
+ -- the wakeup was spurious, and to go back to sleep again in that case. We
+ -- don't need to check for pending abort or priority change on the way in
+ -- our out; that is the caller's responsibility.
+
+ -- For Timed_Delay, we are not expecting any cond_signals or other
+ -- interruptions, except for priority changes and aborts. Therefore, we
+ -- don't want to return unless the delay has actually expired, or the call
+ -- has been aborted. In this case, since we want to implement the entire
+ -- delay statement semantics, we do need to check for pending abort and
+ -- priority changes. We can quietly handle priority changes inside the