Interruptible calculations

Jafet jafet.vixle at gmail.com
Tue Apr 14 19:11:38 CEST 2009


I am writing a simple calculator that uses GMP.

I would like it to be human-friendly and especially allow a keyboard
interrupt to quit a calculation and return to the prompt. However, if a
GMP function is executing at the moment I would want to force it to stop
and quit cleanly when the program gets a SIGINT.

Is there some best way to do this, or should I not bother? (I notice
the cpython interpreter, for one, just hangs on bignum calculations
despite otherwise handling ^C.) I would really not prefer to
separate the GMP calling code out into a process of its own or anything
complicated like that just to get a small nifty feature.

Thanks,
Jafet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gmplib.org/list-archives/gmp-discuss/attachments/20090415/cd72aacb/attachment.html>


More information about the gmp-discuss mailing list