Changeset 39080 in project


Ignore:
Timestamp:
10/29/20 17:56:53 (5 weeks ago)
Author:
Moritz Heidkamp
Message:

vandusen: Work around the fact taht dynamic-wind's after thunk is not invoked when the main thunk is exited via an error

Location:
release/4/vandusen/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/vandusen/trunk/vandusen-db.scm

    r24096 r39080  
    44
    55(import chicken scheme)
    6 (use (prefix sql-de-lite sql:) srfi-18 srfi-13)
     6(use (prefix sql-de-lite sql:) srfi-18 srfi-13 vandusen)
    77(reexport (except sql-de-lite exec query sql))
    88
     
    1818  (let ((mx (make-mutex)))
    1919    (lambda (thunk)
    20       (dynamic-wind
     20      (dynamic-wind+
    2121          (lambda ()
    2222            (mutex-lock! mx))
  • release/4/vandusen/trunk/vandusen-remote.scm

    r39079 r39080  
    2121                                     (receive (in out) (tcp-accept listener)
    2222                                              (thread-start! (lambda ()
    23                                                                (dynamic-wind
     23                                                               (dynamic-wind+
    2424                                                                   void
    2525                                                                   (lambda ()
  • release/4/vandusen/trunk/vandusen.scm

    r33475 r39080  
    1414 add-finalizer
    1515 set-nick!
    16  after-connect)
     16 after-connect
     17 dynamic-wind+)
    1718
    1819(import chicken scheme srfi-1 extras data-structures)
     
    5455    (print "debug: " message)))
    5556
     57(define (dynamic-wind+ before thunk after)
     58  (let ((exn #f))
     59    (dynamic-wind
     60        before
     61        (lambda ()
     62          (handle-exceptions e
     63            (set! exn (list e))
     64            (thunk)))
     65        (lambda ()
     66          (after)
     67          (when exn
     68            (signal (car exn)))))))
     69
    5670(define connection #f)
    5771(define connection-mutex (make-mutex))
     
    6276
    6377(define (call-with-connection proc)
    64   (dynamic-wind
     78  (dynamic-wind+
    6579      (lambda ()
    66         (mutex-lock! connection-mutex))
     80        (mutex-lock! connection-mutex))
    6781      (cut proc connection)
    6882      (lambda ()
    69         (mutex-unlock! connection-mutex))))
     83        (mutex-unlock! connection-mutex))))
    7084
    7185(define (start config-file)
Note: See TracChangeset for help on using the changeset viewer.