After doing some looking into my timeout problem, heres is what I'm
finding.
I have a periodic timeout, state timeout, and restart timeout.
void myalarm(int,void *);
void cycle(int,void *);
void restart(int, void *);
globals are,
int psid[8];
int restartid[8];
int myalarmid;
void * iptr;
void myalarm(int tid, void * data)
{
int x, port;
myalarmid = 0;
~
~
check for port event
if(event)
psid[port] = fl_add_timeout(time,cycle,iptr);
myalamid = fl_add_timeout(time,myalarm,iptr);
}
void cycle(int tid, void *data)
{
int x, port;
/* cycle can be called from any or all of 8 ports */
for(x = 0; x< 8; x++) /* look for whos timeout was called */
if( tid == psid[x])
{
port = x;
break;
}
psid[port] = 0;
if(time to restart port)
restartid[port] = fl_add_timeout(time,restart,iptr);
}
void restart( int tid, void * data)
{
int x, port;
for( x = 0; x< 8; x++) /* find which port to restart */
if( tid == restartid[x])
{
port = x;
break;
}
restartid[port] = 0;
if(port did not restart)
restartid[port] = fl_add_timeout(time, restart, iptr); /* wait
and try again */
}
The problem I see is in the restart function. What I have seen is
restart being called
twice with the same tid. Restartid[port] is cleared on the first call,
so when the second
call with the same tid shows up, there's no longer a port associated
with it.
What happens when restart code is being run, then reexecuted
(new timeout) before its done? I would think that the variables from the
executing
copy are pushed until the new call is complete, then pulled back in and
finished.
Any ideas??
Thanks
Joel
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/