Changeset 14519
- Timestamp:
- Dec 28, 2010, 9:05:39 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/lib/macros.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/lib/macros.lisp
r14365 r14519 3218 3218 3219 3219 3220 3221 3222 3223 3220 (defmacro with-read-lock ((lock) &body body) 3224 3221 "Wait until a given lock is available for read-only access, then evaluate 3225 3222 its body with the lock held." 3226 (let* ((p (gensym))) 3223 (let* ((locked (gensym)) 3224 (p (gensym))) 3227 3225 `(with-lock-context 3228 (let* ((,p ,lock)) 3229 (unwind-protect 3230 (progn 3231 (read-lock-rwlock ,p) 3232 ,@body) 3233 (unlock-rwlock ,p)))))) 3234 3226 (let* ((,locked (make-lock-acquisition)) 3227 (,p ,lock)) 3228 (declare (dynamic-extent ,locked)) 3229 (unwind-protect 3230 (progn 3231 (read-lock-rwlock ,p ,locked) 3232 ,@body) 3233 (when (lock-acquisition.status ,locked) (unlock-rwlock ,p))))))) 3235 3234 3236 3235 (defmacro with-write-lock ((lock) &body body) 3237 3236 "Wait until the given lock is available for write access, then execute 3238 3237 its body with the lock held." 3239 (let* ((p (gensym))) 3238 (let* ((locked (gensym)) 3239 (p (gensym))) 3240 3240 `(with-lock-context 3241 (let* ((,p ,lock))3242 (unwind-protect3243 (progn3244 (write-lock-rwlock ,p)3245 ,@body)3246 (unlock-rwlock ,p))))))3247 3248 3241 (let* ((,locked (make-lock-acquisition)) 3242 (,p ,lock)) 3243 (declare (dynamic-extent ,locked)) 3244 (unwind-protect 3245 (progn 3246 (write-lock-rwlock ,p ,locked) 3247 ,@body) 3248 (when (lock-acquisition.status ,locked) (unlock-rwlock ,p))))))) 3249 3249 3250 3250 (defmacro without-gcing (&body body)
Note:
See TracChangeset
for help on using the changeset viewer.
