Article View: comp.sys.amiga.tech
Article #11503Re: Ultimate Wait-GetMsg strategy (?)
From: Urs Ruegger
Date: Fri, 17 Feb 1989 17:44
Date: Fri, 17 Feb 1989 17:44
26 lines
1129 bytes
1129 bytes
In article <494@infohh.rmi.de>, shimoda@infohh.rmi.de (Markus Schmidt) writes:
> Hi!
>
> Every time using a Wait-GetMsg-pair I thought how to do it
> best way. Now I think I got it:
>
> while (1) {
> while (!(imsg= GetMsg(win->UserPort)))
> Wait (1<<win->UserPort->mp_SigBit);
> ... select imsg->Class and break when ended ...
>
> }
Why not use :
while (WaitPort(win->UserPort) {
msg = GetMsg(win->UserPort);
......
ReplyMsg(msg);
if (xyz) break;
}
WaitPort() will return as long as there are _any_ messages in your port.
Only if the port is empty will it wait for the ports SigBit.
Of course this will only wait for one single port, but so does your example.
Technical Details
Message-ID:
<408@Spengat.oz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!munnari!bhpese!Spengat!ursReferences:
<890204105857.21000bb9@elcc.epfl.ch> <494@infohh.rmi.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!munnari!bhpese!Spengat!urs From: urs@Spengat.oz (Urs Ruegger) Newsgroups: comp.sys.amiga.tech Subject: Re: Ultimate Wait-GetMsg strategy (?) Message-ID: <408@Spengat.oz> Date: 17 Feb 89 17:44:13 GMT References: <890204105857.21000bb9@elcc.epfl.ch> <494@infohh.rmi.de> Organization: Spengat Systems, Newcastle Lines: 26