Vanilla List Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

xsg stuff



I'm asking you guys since I'm pretty vague about Unix signal handling.
What xsg does when recording a game is this: it calls
SIGNAL(SIGNALRM, intrupt_setflag)
and then it calls setitimer() to get SIGNALRM signaled every x times
per second.  Then, intrupt_setflag() does this:

void intrupt_setflag()
{
   HANDLE_SIG(SIGNALARM,intrupt_setflag);
   intrupt_flag = 1;
}

And the input() loop checks for intrupt_flag; when it is, it writes
out a frame.  My question is this: IIANM, HANDLE_SIG and SIGNAL are both
#defined to the system call signal().  (Any reason why?)  Does the
signal handler need to be re-specified after each interrupt, or is
this HANDLE_SIG line in intrupt_setflag() superfluous?

Oh, and a patch to xsg's option.c: without this, the recordspeed
and updatespeed don't match when REALLYFAST is true, and it gets
confused since both are used as indexes into the same array.

-Jonathan

*** option.c    Thu Apr  1 15:30:31 1999
--- option.c~   Wed Nov 11 19:44:55 1998
***************
*** 40,50 ****
                       "1 update per second",
                       ""};

! char *recordmess[] = {
! #ifdef REALLYFAST
!                      "10 updates per second",
! #endif
!                      "record 5 frames per second",
                       "record 4 frames per second",
                       "record 2 frames per second",
                       "record 1 frames per second",
--- 40,46 ----
                       "1 update per second",
                       ""};

! char *recordmess[] = { "record 5 frames per second",
                       "record 4 frames per second",
                       "record 2 frames per second",
                       "record 1 frames per second",