Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!caen!maize.engin.umich.edu!milamber From: milamber@caen.engin.umich.edu (Daryl Cantrell) Newsgroups: comp.sys.amiga.programmer Subject: Re: Window Waiting (was ) Message-ID: Date: 24 May 91 20:43:58 GMT References: <1991May24.102345.1@wombat.newcastle.edu.au> <1991May24.092943.31027@kuhub.cc.ukans.edu> Organization: University of Michigan Engineering, Ann Arbor Lines: 42 In article <1991May24.092943.31027@kuhub.cc.ukans.edu> markv@kuhub.cc.ukans.edu writes: [...] >#define BIT(x) (1L << x) >ULONG WakeupMask; >#define WindowBit BIT(MyWindow->UserPort->mp_Sigbit) >#define TimerBit BIT(TimerReplyPort->mp_Sigbit) > >WakeupMask = Wait(WindowBit | TimerBit); > >if (WakeupMask & WindowBit) { > /* Do IDCMP stuff */ >} >if (WakeupMask & TimerBit) { > /* Do update stuff */ >} [...] This is close, but there is one problem. From 1.3 AutoDocs, exec.library/ WaitPort : "It is possible to get a signal for a port WITHOUT a message showing up. Plan for this.". What I usually do is something like: struct Message *Msg; FOREVER { Wait(WindowBit | TimerBit); while (Msg = GetMsg(MyWindow->UserPort)) DoIDCMP(Msg); while (Msg = GetMsg(TimerReplyPort)) DoTimer(Msg); } >Mark Gooderum Only... \ Good Cheer !!! >Internet: markv@kuhub.cc.ukans.edu -- +---------------------------------------+----------------------------+ | // Daryl S. Cantrell | These opinions are | | |\\\ milamber@caen.engin.umich.edu | shared by all of // | | |// Evolution's over. We won. | Humanity. \X/ | +---------------------------------------+----------------------------+