/[cmucl]/src/code/scavhook.lisp
ViewVC logotype

Contents of /src/code/scavhook.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Tue Jul 30 00:40:04 1991 UTC (22 years, 9 months ago) by wlott
Branch: MAIN
Initial revision
1 ;;; -*- Package: EXT -*-
2 ;;;
3 ;;; **********************************************************************
4 ;;; This code was written as part of the CMU Common Lisp project at
5 ;;; Carnegie Mellon University, and has been placed in the public domain.
6 ;;; If you want to use this code or any part of CMU Common Lisp, please contact
7 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
8 ;;;
9 (ext:file-comment
10 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/scavhook.lisp,v 1.1 1991/07/30 00:40:04 wlott Exp $")
11 ;;;
12 ;;; **********************************************************************
13 ;;;
14 ;;; This file implements the ``Scavenger Hook'' extension.
15 ;;;
16 ;;; Written by William Lott
17 ;;;
18
19 (in-package "EXT")
20
21 (export '(scavenger-hook scavenger-hook-p make-scavenger-hook
22 scavenger-hook-value scavenger-hook-function))
23
24 (defun scavenger-hook-p (object)
25 "Returns T if OBJECT is a scavenger-hook, and NIL if not."
26 (scavenger-hook-p object))
27
28 (defun make-scavenger-hook (&key value (function (required-argument)))
29 "Create a new scavenger-hook with the specified VALUE and FUNCTION. For
30 as long as the scavenger-hook is alive, the scavenger in the garbage
31 collector will note whenever VALUE is moved, and arrange for FUNCTION
32 to be funcalled."
33 (declare (type function function))
34 (c::%make-scavenger-hook value function))
35
36 (defun scavenger-hook-value (scavhook)
37 "Returns the VALUE being monitored by SCAVHOOK. Can be setf."
38 (declare (type scavenger-hook scavhook))
39 (scavenger-hook-value scavhook))
40
41 (defun (setf scavenger-hook-value) (value scavhook)
42 (declare (type scavenger-hook scavhook))
43 (setf (scavenger-hook-value scavhook) value))
44
45 (defun scavenger-hook-function (scavhook)
46 "Returns the FUNCTION invoked when the monitored value is moved. Can be
47 setf."
48 (declare (type scavenger-hook scavhook))
49 (scavenger-hook-function scavhook))
50
51 (defun (setf scavenger-hook-function) (function scavhook)
52 (declare (type function function)
53 (type scavenger-hook scavhook))
54 (setf (scavenger-hook-function scavhook) function))
55

  ViewVC Help
Powered by ViewVC 1.1.5