Of course, shortly after I sent out my question to the list i got a lead
which answered it for me. The only problem is that the
"while( blockage);" is really ugly. Does anyone have any other
suggestions of how to get around this?
---
this sets up the interrupt handler for when you get an alarm.
// initialization code
{
itimerval interval, old;
signal( SIG_ALRM, unblock );
// this says how long to wait before starting the interval timer and
// call the signal handler your_func_ptr
interval.it_value.tv_sec = 0;
interval.it_value.tv_usec = 2;
// this says how frequently to call your_func_ptr
interval.it_interval.tv_sec = 0;
interval.it_interval.tv_usec = 2;
setitimer( ITIMER_REAL, interval, &old );
}
// global stuff
int blockage = 1;
// in main
{
// your loop
{
// waits till the blockage is set to 0
// it wasts a lot of processor time but works easy
while( blockage );
blockage = 1;
// do something
}
}
void unblock( )
{
// clears the blockage and the while loop stops spinning
blockage = 0;
}
---
Joshua W. H. Steiner - [EMAIL PROTECTED] - http://joschi.base.org
If you think the problem is bad now, just wait until we've solved it.
-Arthur Kasspe