W
weserver
Unregistered / Unconfirmed
GUEST, unregistred user!
bt:=CreateEvent(nil,false,false,nil);
dgt:=CreateEvent(nil,false,false,nil);
gt:=CreateEvent(nil,false,false,nil);
boths:='yes;
进程一
While not Terminateddo
begin
WaitForSingleobject(bt,infinite);
.....
.....
.....
setEvent(dgt);//调用进程三
end;
进程二
While not Terminateddo
begin
WaitForSingleobject(gt,infinite);
.....
.....
.....
setEvent(dgt);//调用进程三
end;
进程三
While not Terminateddo
begin
WaitForSingleobject(gt,infinite);
.....
.....
.....
if boths='yes' then
begin
boths:='no';
setEvent(gt);//调用进程二
end;
end;
为什么我执行 setEvent(bt);后,进程一执行一次就停止了,而进程二执行一次后无法停止,该如何让进程二执行一次后也自动停止
dgt:=CreateEvent(nil,false,false,nil);
gt:=CreateEvent(nil,false,false,nil);
boths:='yes;
进程一
While not Terminateddo
begin
WaitForSingleobject(bt,infinite);
.....
.....
.....
setEvent(dgt);//调用进程三
end;
进程二
While not Terminateddo
begin
WaitForSingleobject(gt,infinite);
.....
.....
.....
setEvent(dgt);//调用进程三
end;
进程三
While not Terminateddo
begin
WaitForSingleobject(gt,infinite);
.....
.....
.....
if boths='yes' then
begin
boths:='no';
setEvent(gt);//调用进程二
end;
end;
为什么我执行 setEvent(bt);后,进程一执行一次就停止了,而进程二执行一次后无法停止,该如何让进程二执行一次后也自动停止