[Openmcl-devel] interruptions

Gary Byers gb at clozure.com
Thu Feb 23 23:30:41 PST 2012


Sorry to have missed this message.

If you're asking how to affect what happens when the OS-level process
receives a SIGINT (as would be produced by a user typing ^C), there's
basically a two-part answer.

The first part is that hooking into what currently happens - where some
thread, typically the listener, gets forced via PROCESS-INTERRUPT to
enter a break loop - is awkward.

The second part of the answer is that WAIT-FOR-SIGNAL can be used
to determine if and when an asynchronous signal like ^C occurs; what
to do in response is up to you.

WAIT-FOR-SIGNAL was introduced in CCL 1.6; the 1.6 release notes say:

"The function ccl:wait-for-signal takes two arguments: a signal number,
and a duration in seconds. It will wait until the signal is received,
or until the specified number of seconds has passed. If the signal
number is one that is used by the lisp internally, an error will be
signaled. An error will always be signaled on Windows."


If WAIT-FOR-SIGNAL is used to wait for #$SIGINT in a session, that
overrides the builtin, inflexible-but-useful handling of #$SIGINT
for the rest of the session.  The DURATION argument can be any real
number between 0 and #x7fffffff inclusive; a duration of NIL is treated
as the maximum value.

If you meant something else by "user interruptions", I didn't understand.


On Mon, 20 Feb 2012, Pascal J. Bourguignon wrote:

>
> How can a program handle user interruptions?
>
> In the manual, I only find PROCESS-INTERRUPT and
> WITH/WITHOUT-INTERRUPTS, but I cannot find anything to handle user
> interruptions.
>
>
> (In clisp, user interruptions translate to
> SYSTEM::SIMPLE-INTERRUPT-CONDITION which can be handled as the normal
> conditions they are.  I hear a similar condition exists in sbcl).
>
> -- 
> __Pascal Bourguignon__                     http://www.informatimago.com/
> A bad day in () is better than a good day in {}.
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list