Changeset 7678


Ignore:
Timestamp:
Nov 19, 2007, 7:56:40 AM (12 years ago)
Author:
gb
Message:

WITH-LOCK-CONTEXT.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/lib/macros.lisp

    r7647 r7678  
    23352335         (free-resource ,resource-var ,var))))))
    23362336
     2337;;; Bind per-thread specials which help with lock accounting.
     2338(defmacro with-lock-context (&body body)
     2339  `(let* ((*locks-held* *locks-held*)
     2340          (*locks-pending* *locks-pending*)
     2341          (*lock-conses* *lock-conses*))
     2342    ,@body))
     2343
    23372344(defmacro with-lock-grabbed ((lock &optional
    23382345                                   (whostate "Lock"))
     
    23412348the lock held."
    23422349  (declare (ignore whostate))
    2343   `(with-recursive-lock (,lock) ,@body))
     2350  `(with-lock-context
     2351    (with-recursive-lock (,lock) ,@body)))
    23442352
    23452353(defmacro with-lock-grabbed-maybe ((lock &optional
     
    23472355                                   &body body)
    23482356  (declare (ignore whostate))
    2349   `(with-recursive-lock-maybe (,lock) ,@body))
     2357  `(with-lock-context
     2358    (with-recursive-lock-maybe (,lock) ,@body)))
    23502359
    23512360(defmacro with-standard-abort-handling (abort-message &body body)
     
    30123021its body with the lock held."
    30133022  (let* ((p (gensym)))
    3014     `(let* ((,p ,lock))
    3015       (unwind-protect
    3016            (progn
    3017              (read-lock-rwlock ,p)
    3018              ,@body)
    3019         (unlock-rwlock ,p)))))
     3023    `(with-lock-context
     3024      (let* ((,p ,lock))
     3025        (unwind-protect
     3026             (progn
     3027               (read-lock-rwlock ,p)
     3028               ,@body)
     3029          (unlock-rwlock ,p))))))
    30203030
    30213031
     
    30243034its body with the lock held."
    30253035  (let* ((p (gensym)))
    3026     `(let* ((,p ,lock))
    3027       (unwind-protect
    3028            (progn
    3029              (write-lock-rwlock ,p)
    3030              ,@body)
    3031         (unlock-rwlock ,p)))))
     3036    `(with-lock-context
     3037      (let* ((,p ,lock))
     3038        (unwind-protect
     3039             (progn
     3040               (write-lock-rwlock ,p)
     3041               ,@body)
     3042          (unlock-rwlock ,p))))))
    30323043
    30333044
Note: See TracChangeset for help on using the changeset viewer.