diff options
Diffstat (limited to 'tests/gpgscm/ffi.scm')
-rw-r--r-- | tests/gpgscm/ffi.scm | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/tests/gpgscm/ffi.scm b/tests/gpgscm/ffi.scm index c5f373c17..b62fd1f8a 100644 --- a/tests/gpgscm/ffi.scm +++ b/tests/gpgscm/ffi.scm @@ -47,39 +47,3 @@ ;; Low-level mechanism to terminate the process. (ffi-define (_exit status)) - -;; High-level mechanism to terminate the process is to throw an error -;; of the form (*interpreter-exit* status). This gives automatic -;; resource management a chance to clean up. -(define *interpreter-exit* (gensym)) -(define (throw . x) - (cond - ((more-handlers?) - (apply (pop-handler) x)) - ((and (= 2 (length x)) (equal? *interpreter-exit* (car x))) - (*run-atexit-handlers*) - (_exit (cadr x))) - (else - (apply error x)))) -(set! *error-hook* throw) - -;; Terminate the process returning STATUS to the parent. -(define (exit status) - (throw *interpreter-exit* status)) - -;; A list of functions run at interpreter shutdown. -(define *atexit-handlers* (list)) - -;; Execute all these functions. -(define (*run-atexit-handlers*) - (unless (null? *atexit-handlers*) - (let ((proc (car *atexit-handlers*))) - ;; Drop proc from the list so that it will not get - ;; executed again even if it raises an exception. - (set! *atexit-handlers* (cdr *atexit-handlers*)) - (proc) - (*run-atexit-handlers*)))) - -;; Register a function to be run at interpreter shutdown. -(define (atexit proc) - (set! *atexit-handlers* (cons proc *atexit-handlers*))) |