Multiple WaitPort()s
12-Apr-88 22:37:51
Sb: #118885-Multiple WaitPort()s
Fm: Jim Vogel 73177,441
To: Art Steinmetz 76044,3204
Art,
Try this. Yuo will have to change the second siganl sert to be your serial
port, where here I am waiting for two window.Userports. But it should still
work. This has not given me any problems yet.
Please let me know how it works. PROCEDURE MainLoop; VAR
msg : IntuiMessagePtr;
BEGIN
WHILE NOT stop DO
sig := Wait(SignalSet{CARDINAL(dwptr^.UserPort^.mpSigBit)}+
SignalSet{CARDINAL(gwptr^.UserPort^.mpSigBit)});
LOOP
msg := GetMsg(gwptr^.UserPort^);
IF msg = NIL THEN
msg := GetMsg(dwptr^.UserPort^);
IF msg = NIL THEN
EXIT; END;(*IF msg = NIL*)
END;(*IF msg = NIL*)
ProcIMsg(wproc, msg);
END;(*LOOP*)
END;(*WHILE*) END MainLoop; By the way, ProcIMsg is a prewritten procedure
from Benchamrks simpleIDCMP module. If you dont have that then you would have
to handle making copies of your message's class, code, qualifier BEFORE you
Reply to the message, and then process these yourself
Hope this helps,
Jim Vogel