File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,13 +30,15 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3030#include "intrcheck.h"
3131
3232#include <signal.h>
33+ #include <errno.h>
3334
3435struct signalhandler_list {
3536 int tripped ;
3637 object * func ;
3738};
3839
3940static struct signalhandler_list sig_list [NSIG ];
41+ static int tripped = 0 ; /* Speed up sigcheck() when none tripped */
4042
4143static object * default_sig_object ;
4244static object * default_ignore_object ;
@@ -55,6 +57,7 @@ static RETSIGTYPE
5557signal_handler (sig_num )
5658 int sig_num ;
5759{
60+ tripped ++ ;
5861 sig_list [sig_num ].tripped = 1 ;
5962 (void * )signal (sig_num , & signal_handler );
6063}
@@ -148,7 +151,7 @@ initsignal()
148151
149152 sig_list [0 ].tripped = 0 ;
150153 for (i = 1 ; i < NSIG ; i ++ ) {
151- void * t ; /* type cop-out */
154+ RETSIGTYPE ( * t )();
152155 t = signal (i , SIG_IGN );
153156 signal (i , t );
154157 sig_list [i ].tripped = 0 ;
313316sigcheck ()
314317{
315318 int i ;
316- object * f = getframe ();
319+ object * f ;
320+ if (!tripped )
321+ return 0 ;
322+ f = getframe ();
317323 if (f == NULL )
318324 f = None ;
319325 for (i = 1 ; i < NSIG ; i ++ ) {
@@ -334,6 +340,7 @@ sigcheck()
334340 }
335341 }
336342 }
343+ tripped = 0 ;
337344 return 0 ;
338345}
339346
@@ -348,8 +355,9 @@ initintr()
348355int
349356intrcheck ()
350357{
351- if (!sigcheck ())
352- return 0 ;
353- err_clear ();
354- return 1 ;
358+ if (sig_list [SIGINT ].tripped ) {
359+ sig_list [SIGINT ].tripped = 0 ;
360+ return 1 ;
361+ }
362+ return 0 ;
355363}
You can’t perform that action at this time.
0 commit comments