/[slime]/slime/swank-backend.lisp
ViewVC logotype

Contents of /slime/swank-backend.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.65 - (show annotations)
Sun Sep 12 23:56:39 2004 UTC (9 years, 7 months ago) by mbaringer
Branch: MAIN
Changes since 1.64: +57 -3 lines
2004-09-13  Marco Baringer  <mb@bese.it>

	* swank.lisp: New inspector protocol. The lisp side now returns a
	specially formated list of "things" to format which are then
	passed to emacs and rendered in the inspector buffer. Things can
	be either text, recursivly inspectable values, or functions to
	call.
	(inspected-parts): Redefine for new inspector protocol.
	(*inspectee-parts*): Redefine as array.
	(*inspectee-actions*): New array, similar to *inspectee-parts*.
	(reset-inspector): Update for new implementation of
	*inspectee-parts* and new variable *inspectee-actions*.
	(inspector-contents-for-emacs): New function.
	(inspect-object): Update for new inspector protocol.
	(inspector-nth-part): Update for new *inspectee-parts*
	implementation.
	(inspector-call-nth-action): New function.

	* slime.el (slime-inspector-action-face): New face.
	(slime-open-inspector): Adapt to new inspector protocol.
	(slime-inspector-operate-on-point): New function, subsumes
	slime-inspector-inspect-object-at-point.
	(slime-inspector-next-inspectable-object): Skip to next object,
	not just end of current object; wrap around buffer.
	(slime-inspector-mode-map): change bindings of [return] and "\C-m"

	* swank-bacend.lisp (swank-mop): New package. Simply defines all
	the MOP related symbols we need from an implementation.
	(arglist): Update doc string. Provide default implementation.
	(function-name): New backend function.

	* swank-allegro.lisp (swank-mop, slot-definition-documentation):
	Implement.

	* swank-sbcl.lisp (swank-mop, slot-definition-documentation,
	function-name): Implement.

	* swank-openmcl.lisp (swank-mop, function-name): Implement.
	(arglist): Implement for function objects.
1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil; outline-regexp: ";;;;;*" -*-
2 ;;;
3 ;;; slime-backend.lisp --- SLIME backend interface.
4 ;;;
5 ;;; Created by James Bielman in 2003. Released into the public domain.
6 ;;;
7 ;;; This file defines the functions that must be implemented
8 ;;; separately for each Lisp. Each is declared as a generic function
9 ;;; for which swank-<implementation>.lisp provides methods.
10
11 (defpackage :swank-backend
12 (:use :common-lisp)
13 (:export #:sldb-condition
14 #:original-condition
15 #:compiler-condition
16 #:message
17 #:short-message
18 #:condition
19 #:severity
20 #:location
21 #:location-p
22 #:location-buffer
23 #:location-position
24 #:position-p
25 #:position-pos
26 #:print-output-to-string
27 #:quit-lisp
28 #:references
29 #:unbound-slot-filler))
30
31 (defpackage :swank-mop
32 (:use)
33 (:export
34 ;; classes
35 #:standard-generic-function
36 #:standard-slot-definition
37 #:standard-method
38 #:standard-class
39 ;; standard-class readers
40 #:class-default-initargs
41 #:class-direct-default-initargs
42 #:class-direct-slots
43 #:class-direct-subclasses
44 #:class-direct-superclasses
45 #:class-finalized-p
46 #:class-name
47 #:class-precedence-list
48 #:class-prototype
49 #:class-slots
50 ;; generic function readers
51 #:generic-function-argument-precedence-order
52 #:generic-function-declarations
53 #:generic-function-lambda-list
54 #:generic-function-methods
55 #:generic-function-method-class
56 #:generic-function-method-combination
57 #:generic-function-name
58 ;; method readers
59 #:method-generic-function
60 #:method-function
61 #:method-lambda-list
62 #:method-specializers
63 #:method-qualifiers
64 ;; slot readers
65 #:slot-definition-allocation
66 #:slot-definition-documentation
67 #:slot-definition-initargs
68 #:slot-definition-initform
69 #:slot-definition-initfunction
70 #:slot-definition-name
71 #:slot-definition-type
72 #:slot-definition-readers
73 #:slot-definition-writers))
74
75 (in-package :swank-backend)
76
77
78 ;;;; Metacode
79
80 (defparameter *interface-functions* '()
81 "The names of all interface functions.")
82
83 (defparameter *unimplemented-interfaces* '()
84 "List of interface functions that are not implemented.
85 DEFINTERFACE adds to this list and DEFIMPLEMENTATION removes.")
86
87 (defmacro definterface (name args documentation &rest default-body)
88 "Define an interface function for the backend to implement.
89 A generic function is defined with NAME, ARGS, and DOCUMENTATION.
90
91 If a DEFAULT-BODY is supplied then NO-APPLICABLE-METHOD is specialized
92 to execute the body if the backend doesn't provide a specific
93 implementation.
94
95 Backends implement these functions using DEFIMPLEMENTATION."
96 (check-type documentation string "a documentation string")
97 (flet ((gen-default-impl ()
98 (let ((received-args (gensym "ARGS-")))
99 `(defmethod ,name ,args ,@default-body))))
100 `(progn (defgeneric ,name ,args (:documentation ,documentation))
101 (pushnew ',name *interface-functions*)
102 ,(if (null default-body)
103 `(pushnew ',name *unimplemented-interfaces*)
104 (gen-default-impl))
105 ;; see <http://www.franz.com/support/documentation/6.2/doc/pages/variables/compiler/s_cltl1-compile-file-toplevel-compatibility-p_s.htm>
106 (eval-when (:compile-toplevel :load-toplevel :execute)
107 (export ',name :swank-backend))
108 ',name)))
109
110 (defmacro defimplementation (name args &body body)
111 `(progn (defmethod ,name ,args ,@body)
112 (if (member ',name *interface-functions*)
113 (setq *unimplemented-interfaces*
114 (remove ',name *unimplemented-interfaces*))
115 (warn "DEFIMPLEMENTATION of undefined interface (~S)" ',name))
116 ',name))
117
118 (defun warn-unimplemented-interfaces ()
119 "Warn the user about unimplemented backend features.
120 The portable code calls this function at startup."
121 (warn "These Swank interfaces are unimplemented:~% ~A"
122 (sort (copy-list *unimplemented-interfaces*) #'string<)))
123
124
125 ;;;; Utilities
126
127 (defmacro with-struct ((conc-name &rest names) obj &body body)
128 "Like with-slots but works only for structs."
129 (flet ((reader (slot) (intern (concatenate 'string
130 (symbol-name conc-name)
131 (symbol-name slot))
132 (symbol-package conc-name))))
133 (let ((tmp (gensym "OO-")))
134 ` (let ((,tmp ,obj))
135 (symbol-macrolet
136 ,(loop for name in names collect
137 (typecase name
138 (symbol `(,name (,(reader name) ,tmp)))
139 (cons `(,(first name) (,(reader (second name)) ,tmp)))
140 (t (error "Malformed syntax in WITH-STRUCT: ~A" name))))
141 ,@body)))))
142
143
144 ;;;; TCP server
145
146 (definterface create-socket (host port)
147 "Create a listening TCP socket on interface HOST and port PORT .")
148
149 (definterface local-port (socket)
150 "Return the local port number of SOCKET.")
151
152 (definterface close-socket (socket)
153 "Close the socket SOCKET.")
154
155 (definterface accept-connection (socket)
156 "Accept a client connection on the listening socket SOCKET. Return
157 a stream for the new connection.")
158
159 (definterface add-sigio-handler (socket fn)
160 "Call FN whenever SOCKET is readable.")
161
162 (definterface remove-sigio-handlers (socket)
163 "Remove all sigio handlers for SOCKET.")
164
165 (definterface add-fd-handler (socket fn)
166 "Call FN when Lisp is waiting for input and SOCKET is readable.")
167
168 (definterface remove-fd-handlers (socket)
169 "Remove all fd-handlers for SOCKET.")
170
171 (definterface preferred-communication-style ()
172 "Return one of the symbols :spawn, :sigio, :fd-handler, or NIL."
173 nil)
174
175 ;;; Base condition for networking errors.
176 (define-condition network-error (simple-error) ())
177
178 (definterface emacs-connected (stream)
179 "Hook called when the first connection from Emacs is established.
180 Called from the INIT-FN of the socket server that accepts the
181 connection.
182
183 This is intended for setting up extra context, e.g. to discover
184 that the calling thread is the one that interacts with Emacs.
185
186 STREAM is the redirected user output stream to Emacs. This is passed
187 so that the backend can apply buffer flushing magic."
188 nil)
189
190
191 ;;;; Unix signals
192
193 (defconstant +sigint+ 2)
194
195 (definterface call-without-interrupts (fn)
196 "Call FN in a context where interrupts are disabled."
197 (funcall fn))
198
199 (definterface getpid ()
200 "Return the (Unix) process ID of this superior Lisp.")
201
202 (definterface lisp-implementation-type-name ()
203 "Return a short name for the Lisp implementation."
204 (lisp-implementation-type))
205
206 (definterface default-directory ()
207 "Return the default directory."
208 (directory-namestring (truename *default-pathname-defaults*)))
209
210 (definterface set-default-directory (directory)
211 "Set the default directory.
212 This is used to resolve filenames without directory component."
213 (setf *default-pathname-defaults* (truename (merge-pathnames directory)))
214 (default-directory))
215
216 (definterface call-with-syntax-hooks (fn)
217 "Call FN with hooks to handle special syntax."
218 (funcall fn))
219
220 (definterface default-readtable-alist ()
221 "Return a suitable initial value for SWANK:*READTABLE-ALIST*."
222 '())
223
224 (definterface quit-lisp ()
225 "Exit the current lisp image.")
226
227
228 ;;;; Compilation
229
230 (definterface call-with-compilation-hooks (func)
231 "Call FUNC with hooks to record compiler conditions.")
232
233 (defmacro with-compilation-hooks ((&rest ignore) &body body)
234 "Execute BODY as in CALL-WITH-COMPILATION-HOOKS."
235 (declare (ignore ignore))
236 `(call-with-compilation-hooks (lambda () (progn ,@body))))
237
238 (definterface swank-compile-string (string &key buffer position directory)
239 "Compile source from STRING. During compilation, compiler
240 conditions must be trapped and resignalled as COMPILER-CONDITIONs.
241
242 If supplied, BUFFER and POSITION specify the source location in Emacs.
243
244 Additionally, if POSITION is supplied, it must be added to source
245 positions reported in compiler conditions.
246
247 If DIRECTORY is specified it may be used by certain implementations to
248 rebind *DEFAULT-PATHNAME-DEFAULTS* which may improve the recording of
249 source information.")
250
251 (definterface operate-on-system (system-name operation-name &rest keyword-args)
252 "Perform OPERATION-NAME on SYSTEM-NAME using ASDF.
253 The KEYWORD-ARGS are passed on to the operation.
254 Example:
255 \(operate-on-system \"SWANK\" \"COMPILE-OP\" :force t)"
256 (unless (member :asdf *features*)
257 (error "ASDF is not loaded."))
258 (with-compilation-hooks ()
259 (let ((operate (find-symbol "OPERATE" :asdf))
260 (operation (find-symbol operation-name :asdf)))
261 (when (null operation)
262 (error "Couldn't find ASDF operation ~S" operation-name))
263 (apply operate operation system-name keyword-args))))
264
265 (definterface swank-compile-file (filename load-p)
266 "Compile FILENAME signalling COMPILE-CONDITIONs.
267 If LOAD-P is true, load the file after compilation.")
268
269 (deftype severity () '(member :error :warning :style-warning :note))
270
271 ;; Base condition type for compiler errors, warnings and notes.
272 (define-condition compiler-condition (condition)
273 ((original-condition
274 ;; The original condition thrown by the compiler if appropriate.
275 ;; May be NIL if a compiler does not report using conditions.
276 :type (or null condition)
277 :initarg :original-condition
278 :accessor original-condition)
279
280 (severity :type severity
281 :initarg :severity
282 :accessor severity)
283
284 (message :initarg :message
285 :accessor message)
286
287 (short-message :initarg :short-message
288 :initform nil
289 :accessor short-message)
290
291 (references :initarg :references
292 :initform nil
293 :accessor references)
294
295 (location :initarg :location
296 :accessor location)))
297
298
299 ;;;; Streams
300
301 (definterface make-fn-streams (input-fn output-fn)
302 "Return character input and output streams backended by functions.
303 When input is needed, INPUT-FN is called with no arguments to
304 return a string.
305 When output is ready, OUTPUT-FN is called with the output as its
306 argument.
307
308 Output should be forced to OUTPUT-FN before calling INPUT-FN.
309
310 The streams are returned as two values.")
311
312 (definterface make-stream-interactive (stream)
313 "Do any necessary setup to make STREAM work interactively.
314 This is called for each stream used for interaction with the user
315 \(e.g. *standard-output*). An implementation could setup some
316 implementation-specific functions to control output flushing at the
317 like."
318 nil)
319
320
321 ;;;; Documentation
322
323 (definterface arglist (name)
324 "Return the lambda list for the symbol NAME. NAME can also be
325 a lisp function object, on lisps which support this.
326
327 The result can be a list or the :not-available if the arglist
328 cannot be determined."
329 (declare (ignore name))
330 :not-available)
331
332 (definterface function-name (function)
333 "Return the name of the function object FUNCTION.
334
335 The result is either a symbol, a list, or NIL if no function name is available."
336 (declare (ignore function))
337 nil)
338
339 (definterface macroexpand-all (form)
340 "Recursively expand all macros in FORM.
341 Return the resulting form.")
342
343 (definterface describe-symbol-for-emacs (symbol)
344 "Return a property list describing SYMBOL.
345
346 The property list has an entry for each interesting aspect of the
347 symbol. The recognised keys are:
348
349 :VARIABLE :FUNCTION :SETF :TYPE :CLASS :MACRO :COMPILER-MACRO
350 :ALIEN-TYPE :ALIEN-STRUCT :ALIEN-UNION :ALIEN-ENUM
351
352 The value of each property is the corresponding documentation string,
353 or :NOT-DOCUMENTED. It is legal to include keys not listed here.
354
355 Properties should be included if and only if they are applicable to
356 the symbol. For example, only (and all) fbound symbols should include
357 the :FUNCTION property.
358
359 Example:
360 \(describe-symbol-for-emacs 'vector)
361 => (:CLASS :NOT-DOCUMENTED
362 :TYPE :NOT-DOCUMENTED
363 :FUNCTION \"Constructs a simple-vector from the given objects.\")")
364
365 (definterface describe-definition (name type)
366 "Describe the definition NAME of TYPE.
367 TYPE can be any value returned by DESCRIBE-SYMBOL-FOR-EMACS.
368
369 Return a documentation string, or NIL if none is available.")
370
371
372 ;;;; Debugging
373
374 (definterface call-with-debugging-environment (debugger-loop-fn)
375 "Call DEBUGGER-LOOP-FN in a suitable debugging environment.
376
377 This function is called recursively at each debug level to invoke the
378 debugger loop. The purpose is to setup any necessary environment for
379 other debugger callbacks that will be called within the debugger loop.
380
381 For example, this is a reasonable place to compute a backtrace, switch
382 to safe reader/printer settings, and so on.")
383
384 (define-condition sldb-condition (condition)
385 ((original-condition
386 :initarg :original-condition
387 :accessor original-condition))
388 (:report (lambda (condition stream)
389 (format stream "Condition in debugger code~@[: ~A~]"
390 (original-condition condition))))
391 (:documentation
392 "Wrapper for conditions that should not be debugged.
393
394 When a condition arises from the internals of the debugger, it is not
395 desirable to debug it -- we'd risk entering an endless loop trying to
396 debug the debugger! Instead, such conditions can be reported to the
397 user without (re)entering the debugger by wrapping them as
398 `sldb-condition's."))
399
400 (definterface compute-backtrace (start end)
401 "Return a list containing a backtrace of the condition current
402 being debugged. The results are unspecified if this function is
403 called outside the dynamic contour CALL-WITH-DEBUGGING-ENVIRONMENT.
404
405 START and END are zero-based indices constraining the number of frames
406 returned. Frame zero is defined as the frame which invoked the
407 debugger. If END is nil, return the frames from START to the end of
408 the stack.")
409
410 (definterface print-frame (frame stream)
411 "Print frame to stream.")
412
413 (definterface frame-source-location-for-emacs (frame-number)
414 "Return the source location for FRAME-NUMBER.")
415
416 (definterface frame-catch-tags (frame-number)
417 "Return a list of XXX list of what? catch tags for a debugger
418 stack frame. The results are undefined unless this is called
419 within the dynamic contour of a function defined by
420 DEFINE-DEBUGGER-HOOK.")
421
422 (definterface frame-locals (frame-number)
423 "Return a list of XXX local variable designators define me
424 for a debugger stack frame. The results are undefined unless
425 this is called within the dynamic contour of a function defined
426 by DEFINE-DEBUGGER-HOOK.")
427
428 (definterface frame-var-value (frame var)
429 "Return the value of VAR in FRAME.
430 FRAME is the number of the frame in the backtrace.
431 VAR is the number of the variable in the frame.")
432
433 (definterface disassemble-frame (frame-number)
434 "Disassemble the code for the FRAME-NUMBER.
435 The output should be written to standard output.
436 FRAME-NUMBER is a non-negative interger.")
437
438 (definterface eval-in-frame (form frame-number)
439 "Evaluate a Lisp form in the lexical context of a stack frame
440 in the debugger. The results are undefined unless called in the
441 dynamic contour of a function defined by DEFINE-DEBUGGER-HOOK.
442
443 FRAME-NUMBER must be a positive integer with 0 indicating the
444 frame which invoked the debugger.
445
446 The return value is the result of evaulating FORM in the
447 appropriate context.")
448
449 (definterface return-from-frame (frame-number form)
450 "Unwind the stack to the frame FRAME-NUMBER and return the value(s)
451 produced by evaluating FORM in the frame context to its caller.
452
453 Execute any clean-up code from unwind-protect forms above the frame
454 during unwinding.
455
456 Return a string describing the error if it's not possible to return
457 from the frame.")
458
459 (definterface restart-frame (frame-number)
460 "Restart execution of the frame FRAME-NUMBER with the same arguments
461 as it was called originally.")
462
463 (definterface format-sldb-condition (condition)
464 "Format a condition for display in SLDB."
465 (princ-to-string condition))
466
467 (definterface condition-references (condition)
468 "Return a list of documentation references for a condition.
469 Each reference is one of:
470 (:ANSI-CL
471 {:FUNCTION | :SPECIAL-OPERATOR | :MACRO | :SECTION | :GLOSSARY }
472 symbol-or-name)
473 (:SBCL :NODE node-name)"
474 '())
475
476 (definterface sldb-step (frame-number)
477 "Step to the next code location in the frame FRAME-NUMBER.")
478
479
480
481 ;;;; Definition finding
482
483 (defstruct (:location (:type list) :named
484 (:constructor make-location
485 (buffer position &optional hints)))
486 buffer position
487 ;; Hints is a property list optionally containing:
488 ;; :snippet SOURCE-TEXT
489 ;; This is a snippet of the actual source text at the start of
490 ;; the definition, which could be used in a text search.
491 hints)
492
493 (defstruct (:error (:type list) :named (:constructor)) message)
494 (defstruct (:file (:type list) :named (:constructor)) name)
495 (defstruct (:buffer (:type list) :named (:constructor)) name)
496 (defstruct (:position (:type list) :named (:constructor)) pos)
497
498 (definterface find-definitions (name)
499 "Return a list ((DSPEC LOCATION) ...) for NAME's definitions.
500
501 NAME is a \"definition specifier\".
502
503 DSPEC is a \"definition specifier\" describing the
504 definition, e.g., FOO or (METHOD FOO (STRING NUMBER)) or
505 \(DEFVAR FOO).
506
507 LOCATION is the source location for the definition.")
508
509 (definterface buffer-first-change (filename)
510 "Called for effect the first time FILENAME's buffer is modified."
511 nil)
512
513
514 ;;;; XREF
515
516 (definterface who-calls (function-name)
517 "Return the call sites of FUNCTION-NAME (a symbol).
518 The results is a list ((DSPEC LOCATION) ...).")
519
520 (definterface who-references (variable-name)
521 "Return the locations where VARIABLE-NAME (a symbol) is referenced.
522 See WHO-CALLS for a description of the return value.")
523
524 (definterface who-binds (variable-name)
525 "Return the locations where VARIABLE-NAME (a symbol) is bound.
526 See WHO-CALLS for a description of the return value.")
527
528 (definterface who-sets (variable-name)
529 "Return the locations where VARIABLE-NAME (a symbol) is set.
530 See WHO-CALLS for a description of the return value.")
531
532 (definterface who-macroexpands (macro-name)
533 "Return the locations where MACRO-NAME (a symbol) is expanded.
534 See WHO-CALLS for a description of the return value.")
535
536 (definterface who-specializes (class-name)
537 "Return the locations where CLASS-NAME (a symbol) is specialized.
538 See WHO-CALLS for a description of the return value.")
539
540 ;;; Simpler variants.
541
542 (definterface list-callers (function-name)
543 "List the callers of FUNCTION-NAME.
544 This function is like WHO-CALLS except that it is expected to use
545 lower-level means. Whereas WHO-CALLS is usually implemented with
546 special compiler support, LIST-CALLERS is usually implemented by
547 groveling for constants in function objects throughout the heap.
548
549 The return value is as for WHO-CALLS.")
550
551 (definterface list-callees (function-name)
552 "List the functions called by FUNCTION-NAME.
553 See LIST-CALLERS for a description of the return value.")
554
555
556 ;;;; Profiling
557
558 ;;; The following functions define a minimal profiling interface.
559
560 (definterface profile (fname)
561 "Marks symbol FNAME for profiling.")
562
563 (definterface profiled-functions ()
564 "Returns a list of profiled functions.")
565
566 (definterface unprofile (fname)
567 "Marks symbol FNAME as not profiled.")
568
569 (definterface unprofile-all ()
570 "Marks all currently profiled functions as not profiled."
571 (dolist (f (profiled-functions))
572 (unprofile f)))
573
574 (definterface profile-report ()
575 "Prints profile report.")
576
577 (definterface profile-reset ()
578 "Resets profile counters.")
579
580 (definterface profile-package (package callers-p methods)
581 "Wrap profiling code around all functions in PACKAGE. If a function
582 is already profiled, then unprofile and reprofile (useful to notice
583 function redefinition.)
584
585 If CALLERS-P is T names have counts of the most common calling
586 functions recorded.
587
588 When called with arguments :METHODS T, profile all methods of all
589 generic functions having names in the given package. Generic functions
590 themselves, that is, their dispatch functions, are left alone.")
591
592
593 ;;;; Inspector
594
595 (defstruct (unbound-slot-filler (:print-function print-unbound-slot))
596 "The definition of an object which serves as a placeholder in
597 an unbound slot for inspection purposes.")
598
599 (defun print-unbound-slot (o stream depth)
600 (declare (ignore depth))
601 (print-unreadable-object (o stream :type t)))
602
603 (definterface inspected-parts (object)
604 "Return a short description and a list of (LABEL . VALUE) pairs."
605 (values (format nil "~S is an atom." object) '()))
606
607 (definterface describe-primitive-type (object)
608 "Return a string describing the primitive type of object."
609 (declare (ignore object))
610 "N/A")
611
612
613 ;;;; Multithreading
614 ;;;
615 ;;; The default implementations are sufficient for non-multiprocessing
616 ;;; implementations.
617
618 (definterface startup-multiprocessing ()
619 "Initialize multiprocessing, if necessary.
620
621 This function is called directly through the listener, not in an RPC
622 from Emacs. This is to support interfaces such as CMUCL's
623 MP::STARTUP-IDLE-AND-TOP-LEVEL-LOOPS which does not return like a
624 normal function."
625 nil)
626
627 (definterface spawn (fn &key name)
628 "Create a new thread to call FN.")
629
630 (definterface thread-id (thread)
631 "Return an Emacs-parsable object to identify THREAD.
632
633 Ids should be comparable with equal, i.e.:
634 (equal (thread-id <t1>) (thread-id <t2>)) <==> (eq <t1> <t2>)")
635
636 (definterface find-thread (id)
637 "Return the thread for ID.
638 ID should be an id previously obtained with THREAD-ID.
639 Can return nil if the thread no longer exists.")
640
641 (definterface thread-name (thread)
642 "Return the name of THREAD.
643
644 Thread names are be single-line strings and are meaningful to the
645 user. They do not have to be unique."
646 (declare (ignore thread))
647 "The One True Thread")
648
649 (definterface thread-status (thread)
650 "Return a string describing THREAD's state."
651 (declare (ignore thread))
652 "")
653
654 (definterface make-lock (&key name)
655 "Make a lock for thread synchronization.
656 Only one thread may hold the lock (via CALL-WITH-LOCK-HELD) at a time."
657 (declare (ignore name))
658 :null-lock)
659
660 (definterface call-with-lock-held (lock function)
661 "Call FUNCTION with LOCK held, queueing if necessary."
662 (declare (ignore lock)
663 (type function function))
664 (funcall function))
665
666 (definterface current-thread ()
667 "Return the currently executing thread."
668 0)
669
670 (definterface all-threads ()
671 "Return a list of all threads.")
672
673 (definterface thread-alive-p (thread)
674 "Test if THREAD is termintated."
675 (member thread (all-threads)))
676
677 (definterface interrupt-thread (thread fn)
678 "Cause THREAD to execute FN.")
679
680 (definterface kill-thread (thread)
681 "Kill THREAD."
682 (declare (ignore thread))
683 nil)
684
685 (definterface send (thread object)
686 "Send OBJECT to thread THREAD.")
687
688 (definterface receive ()
689 "Return the next message from current thread's mailbox.")

  ViewVC Help
Powered by ViewVC 1.1.5