Changeset 6200
- Timestamp:
- Apr 7, 2007, 9:32:08 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/linux-files.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/linux-files.lisp
r6013 r6200 76 76 77 77 (defun %process-wait-on-semaphore-ptr (s seconds milliseconds &optional 78 (whostate "semaphore wait") flag) 79 (process-wait whostate #'%wait-on-semaphore-ptr s seconds milliseconds flag)) 78 (whostate "semaphore wait") flag) 79 (or (%wait-on-semaphore-ptr s 0 0 flag) 80 (with-process-whostate (whostate) 81 (loop 82 (when (%wait-on-semaphore-ptr s seconds milliseconds flag) 83 (return)))))) 84 80 85 81 86 (defun wait-on-semaphore (s &optional flag (whostate "semaphore wait")) 82 87 "Wait until the given semaphore has a positive count which can be 83 88 atomically decremented." 84 (%process-wait-on-semaphore-ptr (semaphore-value s) 10 whostate flag)89 (%process-wait-on-semaphore-ptr (semaphore-value s) #xffffff 0 whostate flag) 85 90 t) 86 91 87 92 88 93 (defun %timed-wait-on-semaphore-ptr (semptr duration notification) 89 (multiple-value-bind (secs millis) (milliseconds duration) 90 (let* ((now (get-internal-real-time)) 91 (stop (+ now 92 (* secs 1000) 93 millis))) 94 (loop 95 (multiple-value-bind (success err) 96 (progn 97 (%wait-on-semaphore-ptr semptr secs millis notification)) 98 (when success 99 (return t)) 100 (when (or (not (eql err #$EINTR)) 101 (>= (setq now (get-internal-real-time)) stop)) 102 (return nil)) 103 (unless (zerop duration) 104 (let* ((diff (- stop now))) 105 (multiple-value-bind (remaining-seconds remaining-millis) 106 (floor diff 1000) 107 (setq secs remaining-seconds 108 millis remaining-millis))))))))) 94 (or (%wait-on-semaphore-ptr semptr 0 0 notification) 95 (with-process-whostate ("Semaphore timed wait") 96 (multiple-value-bind (secs millis) (milliseconds duration) 97 (let* ((now (get-internal-real-time)) 98 (stop (+ now 99 (* secs 1000) 100 millis))) 101 (loop 102 (multiple-value-bind (success err) 103 (progn 104 (%wait-on-semaphore-ptr semptr secs millis notification)) 105 (when success 106 (return t)) 107 (when (or (not (eql err #$EINTR)) 108 (>= (setq now (get-internal-real-time)) stop)) 109 (return nil)) 110 (unless (zerop duration) 111 (let* ((diff (- stop now))) 112 (multiple-value-bind (remaining-seconds remaining-millis) 113 (floor diff 1000) 114 (setq secs remaining-seconds 115 millis remaining-millis))))))))))) 109 116 110 117 (defun timed-wait-on-semaphore (s duration &optional notification) … … 594 601 595 602 596 597 598 603 #+linux-target 599 604 (defun pipe () … … 609 614 #+(or darwin-target freebsd-target) 610 615 (defun pipe () 611 (%stack-block (( pipes 8))612 (let* ((status (#_pipe pipes)))616 (%stack-block ((filedes 8)) 617 (let* ((status (#_pipe filedes))) 613 618 (if (zerop status) 614 (values ( %get-long pipes 0) (%get-long pipes 4))619 (values (paref filedes (:array :int) 0) (paref filedes (:array :int) 1)) 615 620 (%errno-disp (%get-errno)))))) 616 621
Note:
See TracChangeset
for help on using the changeset viewer.
