Changeset 7601


Ignore:
Timestamp:
Nov 6, 2007, 6:33:42 PM (12 years ago)
Author:
gb
Message:

In %nanosleep: don't resume sleep after interrupt if the second timespec
has a negative "seconds" field, or if the remaining time is greater
than the time in the last call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0710/ccl/level-1/l1-lisp-threads.lisp

    r7405 r7601  
    5252          (if (and (< result 0)
    5353                   (eql (%get-errno) (- #$EINTR)))
    54             (psetq aptr bptr bptr aptr)
     54            ;; x86-64 Leopard bug.
     55            (let* ((asec (pref aptr :timespec.tv_sec))
     56                   (bsec (pref bptr :timespec.tv_sec)))
     57              (if (and (>= bsec 0)
     58                       (or (< bsec asec)
     59                           (and (= bsec asec)
     60                                (< (pref bptr :timespec.tv_nsec)
     61                                   (pref aptr :timespec.tv_nsec)))))
     62                (psetq aptr bptr bptr aptr)
     63                (return)))
    5564            (return)))))))
    5665
     
    960969
    961970(defun drain-termination-queue ()
    962   (let ((cell nil)
    963         (population *termination-population*))
    964     (loop
    965     (without-interrupts
    966      (with-lock-grabbed (*termination-population-lock*)
    967        (without-gcing
    968         (let ((list (population-termination-list population)))
    969           (unless list (return))
    970           (setf cell (car list)
    971                 (population-termination-list population) (cdr list))))))
    972       (funcall (cdr cell) (car cell)))))
     971  (with-lock-grabbed (*termination-population-lock*)
     972    (let* ((population *termination-population*))
     973      (loop
     974        (multiple-value-bind (cell existed)
     975            (atomic-pop-uvector-cell population population.termination-list)
     976          (if (not existed)
     977            (return)
     978          (funcall (cdr cell) (car cell))))))))
    973979
    974980(defun cancel-terminate-when-unreachable (object &optional (function nil function-p))
Note: See TracChangeset for help on using the changeset viewer.