#: 20931 S12/OS9/68000 (OSK)
26-Apr-95 13:40:00
Sb: #20927-Alarms 'disappearing'
Fm: Ian J Shearer 100410,2733
To: Kevin Darling 76703,4227 (X)
Kev
The code is so trivial there's not a lot to say about it; it's shown below. As
I said initially, it DOES work for many iterations before a failure occurs.
Two functions are shown. The first sets the timer going, the second is the
signal handler. The function setTimer() is just a wrapper for the OS-9
function call. The handler does the usual of setting a global variable and
masking out further signals until this one is dealt with. (The printf
statement was included when I first saw the problem.) If you can see anything
wrong with this I'd love to know; it appears to be so simple it's hard to see
where it can fail.
Ian.
/*****************************************************************************/
int setTimer(int i_Event, int i_Time)
/*****************************************************************************
* Sets an OS-9 alarm going to generate a signal after the specified time.
*
* Inputs: i_Event signal/event to be generated
* i_Time time interval (in 1/10 of a sec.) before
* signal generated
*
* Returns: -1 if an error occurs
* 0 else
*****************************************************************************/
{
register int i = 0;
int i_err,
i_rval,
i_AlarmID;
/*
* Set an OS-9 alarm for the desired signal/time
*/
if ((i_err = _os_alarm_set(&i_AlarmID, i_Event, ALM_TIME(i_Time))) !=
0)
{
err_report(i_err,__LINE__,__FILE__);
i_rval = -1;
}
return i_rval;
}
/*****************************************************************************/
void handler(int i_signo)
/*****************************************************************************
*OS-9 signal handler. If the received signal is SIGQUIT, set flag to
*abort process.
*
* Inputs: i_signo OS-9 signal received
*
* Returns: ---
*
*****************************************************************************/
{
switch (i_signo)
{
case SIGQUIT:
i_ProzessEndeFlag = TRUE;
break;
case SIG_SIMTRACE:
i_Trace = TRUE;
break;
default:
printf(">",i_signo);
fflush(NULL);
e_Event = (BiteEvent)i_signo;
sigmask(TRUE);
break;
}
}
|