source: release/1.2/source/level-1/l1-processes.lisp @ 10220

Last change on this file since 10220 was 10220, checked in by gb, 13 years ago

Propagate recent changes from trunk:

l1-aprims.lisp: static value of *WHOSTATE* is "Reset".
l1-io.lisp: use stack-allocated temporary buffer in WRITE-PNAME.
l1-lisp-threads.lisp: in THREAD-ENABLE, default "wait" to 1 day.
l1-processes.lisp: PROCESS-WHOSTATE detects and handles static binding

of *WHOSTATE*. PROCESS-ENABLE waits for 1 day, which is effectively
infinite and avoids word-size issues.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.7 KB
Line 
1;;;-*- Mode: Lisp; Package: CCL -*-
2;;;
3;;;   Copyright (C) 1994-2001 Digitool, Inc
4;;;   This file is part of OpenMCL. 
5;;;
6;;;   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
7;;;   License , known as the LLGPL and distributed with OpenMCL as the
8;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9;;;   which is distributed with OpenMCL as the file "LGPL".  Where these
10;;;   conflict, the preamble takes precedence. 
11;;;
12;;;   OpenMCL is referenced in the preamble as the "LIBRARY."
13;;;
14;;;   The LLGPL is also available online at
15;;;   http://opensource.franz.com/preamble.html
16
17
18;; L1-processes.lisp
19
20(cl:in-package "CCL")
21
22
23(let* ((all-processes ())
24       (shutdown-processes ())
25       (all-processes-lock (make-lock)))
26  (defun add-to-all-processes (p)
27    (with-lock-grabbed (all-processes-lock)
28      (pushnew p all-processes :test #'eq)
29      p))
30  (defun remove-from-all-processes (p)
31    (with-lock-grabbed (all-processes-lock)
32      (setq all-processes (delete p all-processes))
33      t))
34  (defun all-processes ()
35    "Obtain a fresh list of all known Lisp threads."
36    (with-lock-grabbed (all-processes-lock)
37      (copy-list all-processes)))
38  (defun shutdown-processes ()
39    (with-lock-grabbed (all-processes-lock)
40      (copy-list shutdown-processes)))
41  (defun %clear-shutdown-proceses ()
42    (setq shutdown-processes nil))
43  (defun add-to-shutdown-processes (p)
44    (with-lock-grabbed (all-processes-lock)
45      (pushnew p shutdown-processes :test #'eq))
46    t)
47  (defun pop-shutdown-processes ()
48    (with-lock-grabbed (all-processes-lock)
49      (pop shutdown-processes)))
50  (defun find-process (id)
51    (etypecase id
52      (process id)
53      (integer (with-lock-grabbed (all-processes-lock)
54                 (find id all-processes
55                       :key #'(lambda (p)
56                                (process-serial-number p)))))
57      (string (with-lock-grabbed (all-processes-lock)
58                (find id all-processes
59                      :key #'(lambda (p)
60                               (process-name p))
61                      :test #'equal))))))
62
63
64
65(defun not-in-current-process (p operation)
66  (if (eq p *current-process*)
67    (error "The current process (~s) can't perform the ~a operation on itself."
68           p operation)))
69
70(defun startup-shutdown-processes ()
71  (let* ((p))
72    (loop
73      (unless (setq p (pop-shutdown-processes)) (return))
74      (new-tcr-for-thread (process-thread p))
75      (%process-preset-internal p)
76      (process-enable p)
77      )))
78
79;;; Done with a queue-fixup so that it will be the last thing
80;;; that happens on startup.
81(queue-fixup
82 (pushnew 'startup-shutdown-processes *lisp-system-pointer-functions*))
83
84
85
86
87
88
89
90(defun wrap-initial-bindings (alist)
91  (mapcar #'(lambda (pair)
92              (destructuring-bind (symbol . valform) pair
93                (cons (require-type symbol 'symbol)
94                      (cond ((symbolp valform)
95                             (constantly (symbol-value valform)))
96                            ((typep valform 'function) valform)
97                            ((consp valform)
98                             (if (eq (car valform) 'quote)
99                               (constantly (cadr valform))
100                               #'(lambda () (apply (car valform) (cdr valform)))))
101                            (t
102                             (constantly valform))))))
103          alist))
104
105
106(defun valid-allocation-quantum-p (x)
107  (and (>= x *host-page-size*)
108       (<= x (default-allocation-quantum))
109       (= (logcount x) 1)))
110
111 
112(let* ((psn -1))
113  (defun %new-psn () (incf psn)))
114
115(defclass process ()
116    ((name :initform nil :initarg :name :accessor process-name)
117     (thread :initarg :thread :accessor process-thread)
118     (initial-form :initform (cons nil nil) :reader process-initial-form)
119     (priority :initform 0 :initarg :priority :accessor process-priority)
120     (persistent :initform nil :initarg :persistent :reader process-persistent)
121     (splice :initform (cons nil nil) :accessor process-splice)
122     (initial-bindings :initform nil :initarg :initial-bindings
123                       :accessor process-initial-bindings)
124     (serial-number :initform (%new-psn) :accessor process-serial-number)
125     (creation-time :initform (get-tick-count) :reader process-creation-time)
126     (total-run-time :initform nil :accessor %process-total-run-time)
127     (ui-object :initform (application-ui-object *application*)
128                :accessor process-ui-object)
129     (termination-semaphore :initform nil
130                            :initarg :termination-semaphore
131                            :accessor process-termination-semaphore
132                            :type (or null semaphore))
133     (allocation-quantum :initform (default-allocation-quantum)
134                         :initarg :allocation-quantum
135                         :reader process-allocation-quantum
136                         :type (satisfies valid-allocation-quantum-p))
137     (dribble-stream :initform nil)
138     (dribble-saved-terminal-io :initform nil)
139     (result :initform (cons nil nil)
140             :reader process-result))
141  (:primary-p t))
142
143(defmethod print-object ((p process) s)
144  (print-unreadable-object (p s :type t :identity t)
145    (format s "~a(~d) [~a]" (process-name p)
146            (process-serial-number p)(process-whostate p))))
147
148(defvar *process-class* (find-class 'process))
149
150(defun processp (p)
151  (memq *process-class* (class-precedence-list (class-of p))))
152
153(set-type-predicate 'process 'processp)
154
155(defun make-process (name &key 
156                          thread
157                          persistent
158                          (priority 0)
159                          (stack-size *default-control-stack-size*)
160                          (vstack-size *default-value-stack-size*)
161                          (tstack-size *default-temp-stack-size*)
162                          (initial-bindings ())
163                          (use-standard-initial-bindings t)
164                          (class (find-class 'process))
165                          (termination-semaphore ())
166                          (allocation-quantum (default-allocation-quantum)))
167  "Create and return a new process."
168  (declare (ignore flavor))
169  (let* ((p (make-instance
170             class
171             :name name
172             :thread (or thread
173                         (new-thread name stack-size  vstack-size  tstack-size))
174             :priority priority
175             :persistent persistent
176             :initial-bindings (append (if use-standard-initial-bindings
177                                         (standard-initial-bindings))
178                                       (wrap-initial-bindings
179                                        initial-bindings))
180             :termination-semaphore (or termination-semaphore
181                                        (make-semaphore))
182             :allocation-quantum allocation-quantum)))
183    (add-to-all-processes p)
184    (setf (car (process-splice p)) p)
185    p))
186
187
188(defstatic *initial-process*
189    (let* ((p (make-process
190               "Initial"
191               :thread *initial-lisp-thread*
192               :priority 0)))
193      p))
194
195
196(defvar *current-process* *initial-process*
197  "Bound in each process, to that process itself.")
198
199(defstatic *interactive-abort-process* *initial-process*)
200
201
202
203
204(defun process-tcr (p)
205  (lisp-thread.tcr (process-thread p)))
206
207
208
209(defun process-exhausted-p (p)
210  (let* ((thread (process-thread p)))
211    (or (null thread)
212        (thread-exhausted-p thread))))
213 
214
215(defun process-whostate (p)
216  "Return a string which describes the status of a specified process."
217  (if (process-exhausted-p p)
218    "Exhausted"
219    (let* ((loc nil))
220    (if (eq p *current-process*)
221      (setq loc (%tcr-binding-location (%current-tcr) '*whostate*))
222      (let* ((tcr (process-tcr p)))
223        (without-interrupts
224         (unwind-protect
225              (progn
226                (%suspend-tcr tcr)
227                (setq loc (%tcr-binding-location tcr '*whostate*)))
228           (%resume-tcr tcr)))))
229    (if loc
230      (%fixnum-ref loc)
231      (if (eq p *initial-process*)
232        "Active"
233        "Reset")))))
234
235(defun (setf process-whostate) (new p)
236  (unless (process-exhausted-p p)
237    (setf (symbol-value-in-process '*whostate* p) new)))
238
239
240
241(defun process-total-run-time (p)
242  (or (%process-total-run-time p)
243      (thread-total-run-time (process-thread p))))
244
245
246
247
248(defun initial-bindings (alist)
249  (let* ((symbols ())
250         (values ()))
251    (dolist (a alist (values (nreverse symbols) (nreverse values)))
252      (push (car a) symbols)
253      (push (funcall (cdr a)) values))))
254
255
256                           
257(defun symbol-value-in-process (sym process)
258  (if (eq process *current-process*)
259    (symbol-value sym)
260    (symbol-value-in-tcr sym (process-tcr process))))
261
262(defun (setf symbol-value-in-process) (value sym process)
263  (if (eq process *current-process*)
264    (setf (symbol-value sym) value)
265    (setf (symbol-value-in-tcr sym (process-tcr process)) value)))
266
267
268(defun process-enable (p &optional (wait (* 60 60 24) wait-p))
269  "Begin executing the initial function of a specified process."
270  (setq p (require-type p 'process))
271  (not-in-current-process p 'process-enable)
272  (when wait-p
273    (check-type wait (unsigned-byte 32)))
274  (unless (car (process-initial-form p))
275    (error "Process ~s has not been preset.  Use PROCESS-PRESET to preset the process." p))
276  (let* ((thread (process-thread p)))
277    (do* ((total-wait wait (+ total-wait wait)))
278         ((thread-enable thread (process-termination-semaphore p) (1- (integer-length (process-allocation-quantum p)))  wait)
279          p)
280      (cerror "Keep trying."
281              "Unable to enable process ~s; have been trying for ~s seconds."
282              p total-wait))))
283
284
285(defmethod (setf process-termination-semaphore) :after (new (p process))
286  (with-macptrs (tcrp)
287    (%setf-macptr-to-object tcrp (process-tcr p))
288    (unless (%null-ptr-p tcrp)
289      (setf (%get-ptr tcrp target::tcr.termination-semaphore)
290            (if new
291              (semaphore-value new)
292              (%null-ptr))))
293    new))
294
295(defun process-resume (p)
296  "Resume a specified process which had previously been suspended
297by process-suspend."
298  (setq p (require-type p 'process))
299  (%resume-tcr (process-tcr p)))
300
301(defun process-suspend (p)
302  "Suspend a specified process."
303  (setq p (require-type p 'process))
304  (if (eq p *current-process*)
305    (error "Suspending the current process can't work.  ~&(If the documentation claims otherwise, it's incorrect.)")
306    (%suspend-tcr (process-tcr p))))
307
308(defun process-suspend-count (p)
309  "Return the number of currently-pending suspensions applicable to
310a given process."
311  (setq p (require-type p 'process))
312  (let* ((thread (process-thread p)))
313    (if thread
314      (lisp-thread-suspend-count thread))))
315
316(defun process-active-p (p)
317  (setq p (require-type p 'process))
318  (and (eql 0 (process-suspend-count p))
319       (not (process-exhausted-p p))))
320 
321;;; Used by process-run-function
322(defun process-preset (process function &rest args)
323  "Set the initial function and arguments of a specified process."
324  (let* ((p (require-type process 'process))
325         (f (require-type function 'function))
326         (initial-form (process-initial-form p)))
327    (declare (type cons initial-form))
328    (not-in-current-process p 'process-preset)
329    ; Not quite right ...
330    (rplaca initial-form f)
331    (rplacd initial-form args)
332    (%process-preset-internal process)))
333
334(defun %process-preset-internal (process)
335   (let* ((initial-form (process-initial-form process))
336         (thread (process-thread process)))
337     (declare (type cons initial-form))
338     (thread-preset
339      thread
340      #'(lambda (process initial-form)
341          (let* ((*current-process* process))
342            (add-to-all-processes process)
343            (multiple-value-bind (syms values)
344                (initial-bindings (process-initial-bindings process))
345              (progv syms values
346                (setq *whostate* "Active")
347                (run-process-initial-form process initial-form)))))
348      process
349      initial-form)
350     process))
351
352
353(defun run-process-initial-form (process initial-form)
354  (let* ((exited nil)
355         (kill (handler-case
356                   (restart-case
357                    (let ((values
358                           (multiple-value-list
359                            (apply (car initial-form)
360                                   (cdr (the list initial-form)))))
361                          (result (process-result process)))
362                      (setf (cdr result) values
363                            (car result) t)
364                      (setq exited t)
365                      nil)
366                    (abort-break () :report "Reset this process")
367                    (abort () :report "Kill this process" (setq exited t)))
368                 (process-reset (condition)
369                   (process-reset-kill condition)))))
370    ;; We either exited from the initial form normally, were told to
371    ;; exit prematurely, or are being reset and should enter the
372    ;; "awaiting preset" state.
373    (if (or kill exited) 
374      (unless (eq kill :toplevel)
375        (process-initial-form-exited process (or kill t)))
376      (progn
377        (thread-change-state (process-thread process) :run :reset)
378        (tcr-set-preset-state (process-tcr process))))
379    nil))
380
381;;; Separated from run-process-initial-form just so I can change it easily.
382(defun process-initial-form-exited (process kill)
383  ;; Enter the *initial-process* and have it finish us up
384  (without-interrupts
385   (if (eq kill :shutdown)
386     (progn
387       (setq *whostate* "Shutdown")
388       (add-to-shutdown-processes process)))
389   (maybe-finish-process-kill process kill)))
390
391(defun maybe-finish-process-kill (process kill)
392  (when (and kill (neq kill :shutdown))
393    (setf (process-whostate process) "Dead")
394    (remove-from-all-processes process)
395    (let ((thread (process-thread process)))
396      (unless (or (eq thread *current-lisp-thread*)
397                  (thread-exhausted-p thread))
398        (kill-lisp-thread thread))))
399  nil)
400
401
402 
403
404(defun require-global-symbol (s &optional env)
405  (let* ((s (require-type s 'symbol))
406         (bits (%symbol-bits s)))
407    (unless (or (logbitp $sym_vbit_global bits)
408                (let* ((defenv (if env (definition-environment env))))
409                  (if defenv
410                    (eq :global (%cdr (assq s (defenv.specials defenv)))))))
411      (error "~s not defined with ~s" s 'defstatic))
412    s))
413
414
415(defmethod print-object ((s lock) stream)
416  (print-unreadable-object (s stream :type t :identity t)
417    (let* ((val (uvref s target::lock._value-cell))
418           (name (uvref s target::lock.name-cell)))
419      (when name
420        (format stream "~s " name))
421      (if (typep val 'macptr)
422        (format stream "[ptr @ #x~x]"
423                (%ptr-to-int val))))))
424
425(defun lockp (l)
426  (eq target::subtag-lock (typecode l)))
427
428(set-type-predicate 'lock 'lockp)
429
430(defun recursive-lock-p (l)
431  (and (eq target::subtag-lock (typecode l))
432       (eq 'recursive-lock (%svref l target::lock.kind-cell))))
433
434(defun read-write-lock-p (l)
435  (and (eq target::subtag-lock (typecode l))
436       (eq 'read-write-lock (%svref l target::lock.kind-cell))))
437
438(setf (type-predicate 'recursive-lock) 'recursive-lock-p
439      (type-predicate 'read-write-lock) 'read-write-lock-p)
440
441
442(defun grab-lock (lock &optional flag)
443  "Wait until a given lock can be obtained, then obtain it."
444  (%lock-recursive-lock-object lock flag))
445
446(defun release-lock (lock)
447  "Relinquish ownership of a given lock."
448  (%unlock-recursive-lock-object lock))
449
450(defun try-lock (lock &optional flag)
451  "Obtain the given lock, but only if it is not necessary to wait for it."
452  (%try-recursive-lock-object lock flag))
453
454(defun lock-acquisition-status (thing)
455  (if (istruct-typep thing 'lock-acquisition)
456    (lock-acquisition.status thing)
457    (report-bad-arg thing 'lock-acquisition)))
458
459(defun clear-lock-acquisition-status (thing)
460  (if (istruct-typep thing 'lock-acquisition)
461    (setf (lock-acquisition.status thing) nil)
462    (report-bad-arg thing 'lock-acquisition)))
463
464(defmethod print-object ((l lock-acquisition) stream)
465  (print-unreadable-object (l stream :type t :identity t)
466    (format stream "[status = ~s]" (lock-acquisition-status l))))
467
468(defun semaphore-notification-status (thing)
469  (if (istruct-typep thing 'semaphore-notification)
470    (semaphore-notification.status thing)
471    (report-bad-arg thing 'semaphore-notification)))
472
473(defun clear-semaphore-notification-status (thing)
474  (if (istruct-typep thing 'semaphore-notification)
475    (setf (semaphore-notification.status thing) nil)
476    (report-bad-arg thing 'semaphore-notification)))
477
478(defmethod print-object ((l semaphore-notification) stream)
479  (print-unreadable-object (l stream :type t :identity t)
480    (format stream "[status = ~s]" (semaphore-notification-status l))))
481
482(defun process-wait (whostate function &rest args)
483  "Causes the current lisp process (thread) to wait for a given
484predicate to return true."
485  (declare (dynamic-extent args))
486  (or (apply function args)
487      (with-process-whostate (whostate)
488        (loop
489          (when (apply function args)
490            (return))
491          ;; Sleep for a tick
492          (%nanosleep 0 *ns-per-tick*)))))
493
494
495
496(defun process-wait-with-timeout (whostate time function &rest args)
497  "Cause the current thread to wait for a given predicate to return true,
498or for a timeout to expire."
499  (declare (dynamic-extent args))
500  (cond ((null time)  (apply #'process-wait whostate function args) t)
501        (t (let* ((win nil)
502                  (when (+ (get-tick-count) time))
503                  (f #'(lambda () (let ((val (apply function args)))
504                                    (if val
505                                      (setq win val)
506                                      (> (get-tick-count) when))))))
507             (declare (dynamic-extent f))
508             (process-wait whostate f)
509             win))))
510
511
512(defmethod process-interrupt ((process process) function &rest args)
513  "Arrange for the target process to invoke a specified function at
514some point in the near future, and then return to what it was doing."
515  (let* ((p (require-type process 'process)))
516    (if (eq p *current-process*)
517      (progn
518        (apply function args)
519        t)
520      (thread-interrupt
521       (process-thread p)
522       process
523       #'apply
524       function args))))
525
526(defmethod process-debug-condition ((p process) condition frame-pointer)
527  (declare (ignore condition frame-pointer)))
528
529
530
531
532;;; This one is in the Symbolics documentation
533(defun process-allow-schedule ()
534  "Used for cooperative multitasking; probably never necessary."
535  (yield))
536
537
538;;; something unique that users won't get their hands on
539(defun process-reset-tag (process)
540  (process-splice process))
541
542(defun process-run-function (name-or-keywords function &rest args)
543  "Create a process, preset it, and enable it."
544  (if (listp name-or-keywords)
545    (%process-run-function name-or-keywords function args)
546    (let ((keywords (list :name name-or-keywords)))
547      (declare (dynamic-extent keywords))
548      (%process-run-function keywords function args))))
549
550(defun %process-run-function (keywords function args)
551  (destructuring-bind (&key (name "Anonymous")
552                            (priority  0)
553                            (stack-size *default-control-stack-size*)
554                            (vstack-size *default-value-stack-size*)
555                            (tstack-size *default-temp-stack-size*)
556                            (initial-bindings ())
557                            (persistent nil)
558                            (use-standard-initial-bindings t)
559                            (termination-semaphore nil)
560                            (allocation-quantum (default-allocation-quantum)))
561                      keywords
562    (setq priority (require-type priority 'fixnum))
563    (let* ((process (make-process name
564                                  :priority priority
565                                  :stack-size stack-size
566                                  :vstack-size vstack-size
567                                  :tstack-size tstack-size
568                                  :persistent persistent
569                                  :use-standard-initial-bindings use-standard-initial-bindings
570                                  :initial-bindings initial-bindings
571                                  :termination-semaphore termination-semaphore
572                                  :allocation-quantum allocation-quantum)))
573      (process-preset process #'(lambda () (apply function args)))
574      (process-enable process)
575      process)))
576
577(defmethod process-reset ((process process) &optional kill)
578  "Cause a specified process to cleanly exit from any ongoing computation."
579  (setq process (require-type process 'process))
580  (unless (memq kill '(nil :kill :shutdown))
581    (setq kill (require-type kill '(member nil :kill :shutdown))))
582  (if (eq process *current-process*)
583    (%process-reset kill)
584    (if (process-exhausted-p process)
585      (maybe-finish-process-kill process kill)
586      (progn
587        (process-interrupt process '%process-reset kill)))))
588
589
590(defun %process-reset (kill)
591  (signal 'process-reset :kill kill)
592  (maybe-finish-process-kill *current-process* kill))
593
594;;; By default, it's just fine with the current process
595;;; if the application/user wants to quit.
596(defmethod process-verify-quit ((process process))
597  t)
598
599(defmethod process-exit-application ((process process) thunk)
600  (when (eq process *initial-process*)
601    (prepare-to-quit)
602    (%set-toplevel thunk)
603    (fresh-line *stdout*)
604    (finish-output *stdout*)
605    (toplevel)))
606
607
608
609(defmethod process-kill ((process process))
610  "Cause a specified process to cleanly exit from any ongoing
611computation, and then exit."
612  (and (process-interrupt process #'%process-reset :kill)
613       (setf (process-kill-issued process) t)))
614
615(defun process-abort (process &optional condition)
616  "Cause a specified process to process an abort condition, as if it
617had invoked abort."
618  (process-interrupt process
619                     #'(lambda ()
620                         (abort condition))))
621
622(defmethod process-reset-and-enable ((process process))
623  (not-in-current-process process 'process-reset-and-enable)
624  (process-reset process)
625  (process-enable process))
626
627(defmethod process-kill-issued ((process process))
628  (cdr (process-splice process)))
629
630(defmethod (setf process-kill-issued) (val (process process))
631  (setf (cdr (process-splice process)) val))
632
633(defun tcr->process (tcr)
634  (dolist (p (all-processes))
635    (when (eq tcr (process-tcr p))
636      (return p))))
637
638(defun current-process-allocation-quantum ()
639  (process-allocation-quantum *current-process*))
640
641(defun (setf current-process-allocation-quantum) (new)
642  (if (valid-allocation-quantum-p new)
643    (with-macptrs (tcrp)
644      (%setf-macptr-to-object tcrp (%current-tcr))
645      (setf (slot-value *current-process* 'allocation-quantum) new
646            (%get-natural tcrp target::tcr.log2-allocation-quantum)
647            (1- (integer-length new)))
648      new)
649    (report-bad-arg new '(satisfies valid-allocation-quantum-p))))
650
651
652(def-standard-initial-binding *backtrace-contexts* nil)
653
654(defmethod exit-interactive-process ((p process))
655  (unless (eq p *initial-process*)
656    (when (eq p *current-process*)
657      (process-kill p))))
658
659(defclass tty-listener (process)
660    ())
661
662(defmethod exit-interactive-process ((p tty-listener))
663  (when (eq p *current-process*)
664    (quit)))
665
666(defmethod process-stop-dribbling ((p process))
667  (with-slots (dribble-stream dribble-saved-terminal-io) p
668    (when dribble-stream
669      (close dribble-stream)
670      (setq dribble-stream nil))
671    (when dribble-saved-terminal-io
672      (setq *terminal-io* dribble-saved-terminal-io
673            dribble-saved-terminal-io nil))))
674
675(defmethod process-dribble ((p process) path)
676  (with-slots (dribble-stream dribble-saved-terminal-io) p
677    (process-stop-dribbling p)
678    (when path
679      (let* ((in (two-way-stream-input-stream *terminal-io*))
680             (out (two-way-stream-output-stream *terminal-io*))
681             (f (open path :direction :output :if-exists :append 
682                      :if-does-not-exist :create)))
683        (without-interrupts
684         (setq dribble-stream f
685               dribble-saved-terminal-io *terminal-io*
686               *terminal-io* (make-echoing-two-way-stream
687                              (make-echo-stream in f)
688                              (make-broadcast-stream out f)))))
689      path)))
690
691(defmethod join-process ((p process) &key (default nil defaultp))
692  (wait-on-semaphore (process-termination-semaphore p) nil "join-process")
693  (let ((result (process-result p)))
694    (cond ((car result) (values-list (cdr result)))
695          (defaultp default)
696          (t (error "Failed to join ~s" p)))))
697
698
699(defmethod process-locks-held ((p process))
700  #+lock-accounting
701  (copy-list (symbol-value-in-process '*locks-held* p)))
702
703(defmethod process-locks-pending ((p process))
704  #+lock-accounting
705  (copy-list (symbol-value-in-process '*locks-pending* p)))
Note: See TracBrowser for help on using the repository browser.