DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦f862c2805⟧ TextFile

    Length: 1536 (0x600)
    Types: TextFile
    Names: »timeoutdok«

Derivation

└─⟦a41ae585a⟧ Bits:30001842 SW-save af projekt 1000, Alarm-system
    └─⟦72244f0ef⟧ 
        └─⟦this⟧ »timeoutdok« 

TextFile

process  timeout  (
   var main_sem: semaphore;               (*  main semaphore  *)
   ticklength,                            (*  m sec per tick  *)
   max         : integer     );           (*  table size      *)

var
count: array (1..max) of integer;
saved: array (1..max) of reference;

begin
alloc ( msg, tickpool, main_sem);
msg^.u3:= ticklength;
signal ( msg, timer);

repeat
wait ( msg, main_sem);
case msg^.u1 of

tick:
begin
signal ( msg, timer);
for index:= 1 to max do
if count(index) > 0 then count(index):= count(index)-1  else
if count(index) = 0 then return ( saved(index));
end;  (*  tick  *)

book:
begin
pop ( time_msg, msg);
index:= top;   top:= top+1;
count(index):= msg.count;
saved(index):=: time_msg;
return ( msg)
end;

update:
begin
index:= msg.index;
if saved(index) = nil then msg^.u2:= result_index  else
begin
if msg.count = 0 then  return ( saved(index))  else
count(index):= msg.count;
msg^.u2:= ok
end
end

otherwise
begin
msg^.u2:= unknown;
return ( msg)
end
end  (*  case  *)

until  forever

end .   (*  of timeout  *)

▶EOF◀