From 6d09299c5d3a12fd2a55e0d76581b4cb68a2a1ba Mon Sep 17 00:00:00 2001 From: mainzelm Date: Wed, 8 May 2002 12:04:56 +0000 Subject: [PATCH] Added on-interrupt. --- modules.scm | 4 +++- sunet-utilities.scm | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules.scm b/modules.scm index 0efc335..2f2d247 100644 --- a/modules.scm +++ b/modules.scm @@ -12,12 +12,14 @@ (files format-net)) (define-interface sunet-utilities-interface - (export host-name-or-ip)) + (export host-name-or-ip + on-interrupt)) (define-structure sunet-utilities sunet-utilities-interface (open scsh scheme format-net + sigevents handle-fatal-error) (files sunet-utilities)) diff --git a/sunet-utilities.scm b/sunet-utilities.scm index ee2a1cd..734a222 100644 --- a/sunet-utilities.scm +++ b/sunet-utilities.scm @@ -9,3 +9,8 @@ (format-internet-host-address ip)))) (host-info:name (host-info addr)))) +(define (on-interrupt interrupt thunk) + (let lp ((event (most-recent-sigevent))) + (let ((next (next-sigevent event interrupt))) + (thunk) + (lp next))))