Changeset 12794


Ignore:
Timestamp:
Sep 9, 2009, 12:55:52 AM (10 years ago)
Author:
rme
Message:

New functions WATCH and UNWATCH.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/misc.lisp

    r12732 r12794  
    10441044              (lock-name lock)
    10451045              (%ptr-to-int (%svref lock target::lock._value-cell)))))
     1046
     1047(defun watch (&optional thing)
     1048  (if thing
     1049    ;; typecheck thing?
     1050    (%watch thing)
     1051    (let (result)
     1052      (%map-areas #'(lambda (x) (push x result)) area-watched area-watched)
     1053      result)))
     1054
     1055(defun unwatch (thing)
     1056  (%map-areas #'(lambda (x)
     1057                  (when (eq x thing)
     1058                    ;; This is a rather questionable thing to do,
     1059                    ;; since we'll be unlinking an area from the area
     1060                    ;; list while %map-areas iterates over it, but I
     1061                    ;; think we'll get away with it.
     1062                    (%unwatch thing)
     1063                    (return-from unwatch)))
     1064              area-watched area-watched))
     1065     
Note: See TracChangeset for help on using the changeset viewer.