Factor out with-locks from surflet-handler
This commit is contained in:
parent
213090a51d
commit
d0782f63a2
|
@ -260,6 +260,9 @@
|
||||||
rt-structure-binding
|
rt-structure-binding
|
||||||
load-structure))
|
load-structure))
|
||||||
|
|
||||||
|
(define-interface with-locks-interface
|
||||||
|
(export with-lock))
|
||||||
|
|
||||||
;; With the help of TYPED-OPTIONALS you can define a function
|
;; With the help of TYPED-OPTIONALS you can define a function
|
||||||
;; like (make-submit-button [string] args)
|
;; like (make-submit-button [string] args)
|
||||||
(define-interface typed-optionals-interface
|
(define-interface typed-optionals-interface
|
||||||
|
@ -375,9 +378,10 @@
|
||||||
locks ;MAKE-LOCK et al.
|
locks ;MAKE-LOCK et al.
|
||||||
profiling ;PROFILE-SPACE
|
profiling ;PROFILE-SPACE
|
||||||
rt-module-language ;get structures dynamically
|
rt-module-language ;get structures dynamically
|
||||||
search-trees
|
|
||||||
scheme-with-scsh ;regexp et al.
|
scheme-with-scsh ;regexp et al.
|
||||||
|
search-trees
|
||||||
shift-reset ;SHIFT and RESET
|
shift-reset ;SHIFT and RESET
|
||||||
|
(subset srfi-1 (alist-cons alist-delete!))
|
||||||
srfi-6 ;string-ports
|
srfi-6 ;string-ports
|
||||||
srfi-14 ;CHAR-SET:DIGIT
|
srfi-14 ;CHAR-SET:DIGIT
|
||||||
srfi-27 ;random numbers
|
srfi-27 ;random numbers
|
||||||
|
@ -389,7 +393,7 @@
|
||||||
thread-safe-counter
|
thread-safe-counter
|
||||||
threads ;SLEEP
|
threads ;SLEEP
|
||||||
uri ;URI-PATH-LIST->PATH
|
uri ;URI-PATH-LIST->PATH
|
||||||
(subset srfi-1 (alist-cons alist-delete!))
|
with-locks ;WITH-LOCK
|
||||||
)
|
)
|
||||||
(files surflet-handler))
|
(files surflet-handler))
|
||||||
|
|
||||||
|
@ -636,3 +640,8 @@
|
||||||
package-commands-internal)
|
package-commands-internal)
|
||||||
(files rt-module))
|
(files rt-module))
|
||||||
|
|
||||||
|
(define-structure with-locks with-locks-interface
|
||||||
|
(open scheme
|
||||||
|
locks)
|
||||||
|
(files with-locks))
|
||||||
|
|
||||||
|
|
|
@ -149,15 +149,6 @@
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; doesn't belong to here...
|
|
||||||
(define (with-lock lock thunk)
|
|
||||||
(dynamic-wind
|
|
||||||
(lambda ()
|
|
||||||
(obtain-lock lock))
|
|
||||||
thunk
|
|
||||||
(lambda ()
|
|
||||||
(release-lock lock))))
|
|
||||||
|
|
||||||
;;; RESUME-URL
|
;;; RESUME-URL
|
||||||
;; Resumes a suspended URL and returns a (HTTP-)RESPONSE. PATH-STRING
|
;; Resumes a suspended URL and returns a (HTTP-)RESPONSE. PATH-STRING
|
||||||
;; is the virtual path, SURFLET-PATH a string pointing to the real
|
;; is the virtual path, SURFLET-PATH a string pointing to the real
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
;; From sunterlib
|
||||||
|
|
||||||
|
(define (with-lock lock thunk)
|
||||||
|
(dynamic-wind
|
||||||
|
(lambda ()
|
||||||
|
(obtain-lock lock))
|
||||||
|
thunk
|
||||||
|
(lambda ()
|
||||||
|
(release-lock lock))))
|
||||||
|
|
Loading…
Reference in New Issue