Minor clean-up.

This commit is contained in:
mainzelm 2001-12-07 11:28:37 +00:00
parent 023caecf53
commit 2e5fd56011
1 changed files with 9 additions and 15 deletions

View File

@ -115,14 +115,13 @@
;;; Should be moved to somewhere else
(define (with-lock lock thunk)
(with-handler (lambda (condition more)
(release-lock lock)
(more))
(lambda ()
(obtain-lock lock)
(let ((result (thunk)))
(release-lock lock)
result))))
(dynamic-wind
(lambda ()
(release-lock lock))
thunk
(lambda ()
(release-lock lock))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -169,11 +168,6 @@
(process-set-resource dir)
(set! *resource-cache* (process-read-resource)))
;; Dynamic-wind is not the right thing to take care of the lock;
;; it would release the lock on every context switch.
;; With-lock releases the lock on a condition, using call/cc will
;; skrew things up
;; The thread-specific resource: A thread fluid
(define $resource 'empty-resource-value)
@ -183,8 +177,8 @@
(define (let-resource dir thunk)
(let-thread-fluid $resource dir thunk))
(define (with-resource* dir thunk)
(let ((changed-dir #f)) ; TODO 0.5 used to have a dynamic-wind here!!!
(define (with-resource* dir thunk)
(let ((changed-dir #f))
(with-lock resource-lock
(lambda ()
(change-and-cache dir)