Fix for bug #7100: when rendering on solaris, pressing esc could

kill the process. Some time ago SIGVTALRM was replaced with SIGALRM
to solve issues on linux, but this signal can kill the process on
solaris, so now it uses SIGVTALRM again there.
This commit is contained in:
Brecht Van Lommel 2008-04-12 17:34:48 +00:00
parent f810245076
commit 98741e0392

@ -1018,7 +1018,7 @@ static void end_test_break_callback()
} }
#else #else
/* all other OS's support signal(SIGVTALRM) */ /* all other OS's support signal(SIGVTALRM/SIGALRM) */
/* XXX The ESC problem: some unix users reported that ESC doesn't cancel /* XXX The ESC problem: some unix users reported that ESC doesn't cancel
* renders anymore. Most complaints came from linux, but it's not * renders anymore. Most complaints came from linux, but it's not
@ -1029,7 +1029,10 @@ static void end_test_break_callback()
* fixes the problem, at least while we investigate better. * fixes the problem, at least while we investigate better.
* *
* ITIMER_REAL (SIGALRM): timer that counts real system time * ITIMER_REAL (SIGALRM): timer that counts real system time
* ITIMER_VIRTUAL (SIGVTALRM): only counts time spent in its owner process */ * ITIMER_VIRTUAL (SIGVTALRM): only counts time spent in its owner process
*
* Addendum: now SIGVTALRM is used on Solaris again, because SIGALRM can
* kill the process there! */
/* POSIX: this function goes in the signal() callback */ /* POSIX: this function goes in the signal() callback */
static void interruptESC(int sig) static void interruptESC(int sig)
@ -1038,7 +1041,11 @@ static void interruptESC(int sig)
if(G.afbreek==0) G.afbreek= 2; /* code for read queue */ if(G.afbreek==0) G.afbreek= 2; /* code for read queue */
/* call again, timer was reset */ /* call again, timer was reset */
#ifdef __sun
signal(SIGVTALRM, interruptESC);
#else
signal(SIGALRM, interruptESC); signal(SIGALRM, interruptESC);
#endif
} }
/* POSIX: initialize timer and signal */ /* POSIX: initialize timer and signal */
@ -1053,8 +1060,13 @@ static void init_test_break_callback()
tmevalue.it_value.tv_sec = 0; tmevalue.it_value.tv_sec = 0;
tmevalue.it_value.tv_usec = 10000; tmevalue.it_value.tv_usec = 10000;
#ifdef __sun
signal(SIGVTALRM, interruptESC);
setitimer(ITIMER_VIRTUAL, &tmevalue, 0);
#else
signal(SIGALRM, interruptESC); signal(SIGALRM, interruptESC);
setitimer(ITIMER_REAL, &tmevalue, 0); setitimer(ITIMER_REAL, &tmevalue, 0);
#endif
} }
/* POSIX: stop timer and callback */ /* POSIX: stop timer and callback */
@ -1064,9 +1076,13 @@ static void end_test_break_callback()
memset(&tmevalue, 0, sizeof(struct itimerval)); memset(&tmevalue, 0, sizeof(struct itimerval));
#ifdef __sun
setitimer(ITIMER_VIRTUAL, &tmevalue, 0);
signal(SIGVTALRM, SIG_IGN);
#else
setitimer(ITIMER_REAL, &tmevalue, 0); setitimer(ITIMER_REAL, &tmevalue, 0);
signal(SIGALRM, SIG_IGN); signal(SIGALRM, SIG_IGN);
#endif
} }