Minor clean-up.
This commit is contained in:
parent
023caecf53
commit
2e5fd56011
|
@ -115,14 +115,13 @@
|
||||||
|
|
||||||
;;; Should be moved to somewhere else
|
;;; Should be moved to somewhere else
|
||||||
(define (with-lock lock thunk)
|
(define (with-lock lock thunk)
|
||||||
(with-handler (lambda (condition more)
|
(dynamic-wind
|
||||||
(release-lock lock)
|
|
||||||
(more))
|
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(obtain-lock lock)
|
(release-lock lock))
|
||||||
(let ((result (thunk)))
|
thunk
|
||||||
(release-lock lock)
|
(lambda ()
|
||||||
result))))
|
(release-lock lock))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
@ -169,11 +168,6 @@
|
||||||
(process-set-resource dir)
|
(process-set-resource dir)
|
||||||
(set! *resource-cache* (process-read-resource)))
|
(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
|
;; The thread-specific resource: A thread fluid
|
||||||
|
|
||||||
(define $resource 'empty-resource-value)
|
(define $resource 'empty-resource-value)
|
||||||
|
@ -184,7 +178,7 @@
|
||||||
(let-thread-fluid $resource dir thunk))
|
(let-thread-fluid $resource dir thunk))
|
||||||
|
|
||||||
(define (with-resource* dir thunk)
|
(define (with-resource* dir thunk)
|
||||||
(let ((changed-dir #f)) ; TODO 0.5 used to have a dynamic-wind here!!!
|
(let ((changed-dir #f))
|
||||||
(with-lock resource-lock
|
(with-lock resource-lock
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(change-and-cache dir)
|
(change-and-cache dir)
|
||||||
|
|
Loading…
Reference in New Issue