🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #11413

Re: Ultimate Wait-GetMsg strategy (?)

#11413
From: Peter da Silva
Date: Fri, 10 Feb 1989 13:03
24 lines
1231 bytes
In article <494@infohh.rmi.de>, shimoda@infohh.rmi.de (Markus Schmidt) writes:
> 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 ...
>
> }

That's really weird. Why don't you just do this:

while(1) {
  Wait(1<<win->UserPort->mp_SigBit);
  while(imsg= GetMsg(win->UserPort) {
    ... select imsg->Class and break when ended ...
  }
}

Which generalises to multiple message ports a lot better.
-- 
Peter "Have you hugged your wolf today" da Silva  `-_-'  Hackercorp.
...texbell!sugar!peter, or peter@sugar.uu.net      'U`
Technical Details
Message-ID: <3415@sugar.uu.net>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!helios.ee.lbl.gov!ncis.llnl.gov!lll-winken!lll-lcc!ames!killer!texbell!uhnix1!sugar!peter
References: <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!tut.cis.ohio-state.edu!ucbvax!agate!helios.ee.lbl.gov!ncis.llnl.gov!lll-winken!lll-lcc!ames!killer!texbell!uhnix1!sugar!peter
From: peter@sugar.uu.net (Peter da Silva)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Ultimate Wait-GetMsg strategy (?)
Message-ID: <3415@sugar.uu.net>
Date: 10 Feb 89 13:03:30 GMT
References: <890204105857.21000bb9@elcc.epfl.ch> <494@infohh.rmi.de>
Organization: Sugar Land Unix - Houston, TX
Lines: 24