#: 20175 S5/OS9 Users Group
04-Aug-94 15:00:30
Sb: #alm_delete bug
Fm: Peter J. Neutelings 100024,171
To: all
/*
I have been searching the os-9 forum libraries for a problem which must be
known
for a couple of years yet, but without result.
We are facing problems with a OS-9 2.4 bug, where processes may delete
each others alarms.
1. A process sets an alarm (e.g. using alm_set()) and stores the ID
for being able to delete the alarm later, using alm_delete().
(For implementing time-outs)
2. The alarm expires
3. Another process starts the alarm, which may get the same ID the
the previously expired alarm from the other process
4. If the first process tries to delete its alarm, it will delete
the 2nd process's alarm!
Of course, a work-around would be to use flags which keep the state of
the alarm (already expired or not) and never try to delete an alarm
which has expired already.
But how can we ever be sure other applications we use (like 3rd party printer
spoolers) are not killing our alarms?
Does anyone know of a rock-solid work-around?
Peter Neutelings, email 100024.171@compuserve.com
Demo alm_delete problem, start as follows:
al &; sleep -s 5; al
*/
#include
int icpthand( sig )
short sig;
{
return sig;
}
void main()
{
int id1, id2;
intercept(icpthand);
id1 = alm_set(200, 300);
id2 = alm_set(200, 600);
printf("set 1:%d\nset 2:%d\n", id1, id2);
sleep(0);
printf("alarm\n");
sleep(0);
printf("alarm\n");
printf("delete 1:%d\n", id1);
alm_delete(id1);
return;
}
There is 1 Reply.
|