[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q about interrupt and catch
From: |
Alex Vong |
Subject: |
Re: Q about interrupt and catch |
Date: |
Tue, 13 Jun 2017 13:24:50 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
"Mike Gran" <address@hidden> writes:
> Hi all,
>
> This is probably a simple question, but, I can't figure it out.
>
> I have a program with a big main loop like this
>
> (while #t
> (let ((c (read-char port)))
> (cond
> ... many different possible operations, depending on c
> )))
>
> I want to make it so, when the program receives a SIGINT, it aborts
> the operation in progress and restarts this big main loop.
>
> Any hints?
>
> Thanks,
> Mike Gran
This is an interesting question. I come up with a solution using the
reset/shift operators. This is the first time I use delimited
continuation. The script is in the attachment. You can run
'chmod +x main-loop.scm' to make the script executable.
main-loop.scm
Description: Binary data
Cheers,
Alex
signature.asc
Description: PGP signature