![]() |
Главная Случайная страница Контакты | Мы поможем в написании вашей работы! | |
|
procedure hold (T);
real T;
inspect FIRSTEV do
begin
if T>0 then EVTIME: = ЕVTIМЕ + T;
if suc = / = none then
begin if suc.EVTIME<EVTIME then
begin
out;
RANK (false);
resume (current)
end
end
end hold;
procedure passivate;
begin
inspect current do
begin
EVENT. out;
EVENT: — none
end;
if SQS.empty then ERROR
else resume (current)
end passivate;
procedure wait (S);
ref (head) S;
begin
current. into (S);
passivate
end wait;
procedure cancel (X);
ref (process) X;
begin
if X = = current then passivate else inspect X do
if EVENT = / = none then
begin
EVENT. out;
EVENT: - none;
end
end cancel;
procedure ACTIVATE (REAC, X, CODE, T, Y, PRIOR);
value CODE;
ref (process) X, Y;
Boolean REAC, PRIOR;
text CODE;
real T;
inspect X do
if ךterminated then
begin
ref (process) Z;
ref (EVENT NOTICE) EV;
if REAC then EV:-EVENT else
if EVENT = / = none then go to exit;
Z: — current;
if CODE = 'direct' then
direct:
begin
EVENT:-new EVENT NOTICE (time,*);
EVENT. precede (FIRSTEV)
end direct
else
if CODE = 'delay' then begin T: = T + time;
go to at
end delay else
if CODE = 'at' then
at:
begin
if T < time then T: = time;
if T = time∩ PRIOR then go to DIRECT;
EVENT:-new EVENT NOTICE (T,X);
EVENT.RANK (PRIOR)
end at
else if (if Y= = none then true else Y. EVENT = = none) then EVENT: — none
else
begin
EVENT:-new EVENT NOTICE (Y. EVENT.EVTIME,X);
if CODE ='before' then EVENT.precede (Y. EVENT)
else EVENT.follow (Y. EVENT)
end before or after;
if EV = / = none then
begin
EV.out;
f SQS.empty then ERROR
end;
if Z = / = current then resume (current);
exit:
end ACTIVATE;
Дата публикования: 2015-01-23; Прочитано: 154 | Нарушение авторского права страницы | Мы поможем в написании вашей работы!