use shift/reset

This commit is contained in:
interp 2002-09-14 16:42:24 +00:00
parent 04b7adbd89
commit 4ae31efbb2
1 changed files with 19 additions and 20 deletions

View File

@ -54,15 +54,15 @@
(define (launch-new-instance full-path req)
(let ((instance-id (generate-new-instance-id))
(plugin (get-plugin-rt-structure full-path)))
(call-with-current-continuation
(lambda (return)
(reset
(begin
(save-instance! full-path instance-id) ; make entry in instance-table
(register-session! instance-id return)
(register-session! instance-id 'no-return)
(with-names-from-rt-structure
plugin plugin-interface
;; MAIN may return in another thread, so we have to lookup
;; return continuation explicitly
((session-return-continuation) (main req)))))))
(main req))))))
;; try to get continuation-table and then the continuation
(define (resume-url full-path req)
@ -82,16 +82,15 @@ You can try starting at the <A HREF=~a>beginning</a>."
(let* ((continuation-table (instance-continuation-table instance-id))
(resume (table-ref continuation-table continuation-id)))
(if resume
(call-with-current-continuation
(lambda (return)
(register-session! instance-id return)
(error "This may never return." ; for debugging
(resume req))))))))))))
(reset
(begin
(register-session! instance-id 'no-return)
; (error "This may never return." ; for debugging
(resume req)))))))))))
(define (send/suspend response-maker)
(call-with-current-continuation
(lambda (return)
(shift return
(let* ((instance-id (session-instance-id))
(continuations-table (instance-continuation-table instance-id))
(continuation-id (generate-new-continuation-id instance-id)))
@ -99,11 +98,11 @@ You can try starting at the <A HREF=~a>beginning</a>."
(let ((new-url (make-resume-url (instance-servlet-name instance-id)
instance-id
continuation-id)))
((session-return-continuation) (response-maker new-url)))))))
(response-maker new-url)))))
(define (send/finish response)
(instance-delete (session-instance-id))
((session-return-continuation) response))
response)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; access to instance-table