Jeroen Demeyer on Tue, 22 Sep 2015 12:01:08 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PATCH] please make pari_sighandler public |
On 2015-09-22 09:30, Bill Allombert wrote:
Perhaps you want to use PARI's handler only for specific signals, or you want to switch between the PARI handler and a custom signal handler in various parts of the program?I am unclear how this gives more fine-grained control than setting your own handler
but if you also write the corresponding documentation, then it is OK with me.
Done, see attachment.
commit 0a879a6132bc3856eb7353531d06b818beb167af Author: Jeroen Demeyer <jdemeyer@cage.ugent.be> Date: Tue Sep 22 11:41:06 2015 +0200 Make pari_sighandler public diff --git a/doc/usersch5.tex b/doc/usersch5.tex index 37c2e14..24f4565 100644 --- a/doc/usersch5.tex +++ b/doc/usersch5.tex @@ -102,6 +102,10 @@ engine. (see \kbd{signal(2)}): the signals \kbd{SIGBUS}, \kbd{SIGFPE}, \kbd{SIGINT}, \kbd{SIGBREAK}, \kbd{SIGPIPE} and \kbd{SIGSEGV} are concerned. +\fun{void}{pari_sighandler}{int signum} the actual signal handler that +PARI uses. This can be used as argument to \kbd{pari\_sig\_init} or +\kbd{signal(2)}. + \fun{void}{pari_stackcheck_init}{void *stackbase} controls the system stack exhaustion checking code in the GP interpreter. This should be used when the system stack base address change or when the address seen by \kbd{pari\_init} diff --git a/src/headers/paridecl.h b/src/headers/paridecl.h index a46cfc3..44d00bb 100644 --- a/src/headers/paridecl.h +++ b/src/headers/paridecl.h @@ -3126,6 +3126,7 @@ char * pari_err2str(GEN err); void pari_init_opts(size_t parisize, ulong maxprime, ulong init_opts); void pari_init(size_t parisize, ulong maxprime); void pari_stackcheck_init(void *pari_stack_base); +void pari_sighandler(int sig); void pari_sig_init(void (*f)(int)); void pari_thread_alloc(struct pari_thread *t, size_t s, GEN arg); void pari_thread_close(void); diff --git a/src/language/init.c b/src/language/init.c index 9414097..7334b80 100644 --- a/src/language/init.c +++ b/src/language/init.c @@ -349,7 +349,6 @@ pari_daemon(void) /*********************************************************************/ static int try_to_recover = 0; THREAD VOLATILE int PARI_SIGINT_block = 0, PARI_SIGINT_pending = 0; -static void pari_sighandler(int sig); /*********************************************************************/ /* SIGNAL HANDLERS */ @@ -377,7 +376,7 @@ pari_handle_SIGINT(void) #endif } -static void +void pari_sighandler(int sig) { const char *msg;