Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sunybcs!rutgers!cbmvax!peter From: peter@cbmvax.commodore.com (Peter Cherna) Newsgroups: comp.sys.amiga.tech Subject: Re: Wait()ing Peacefully Message-ID: <10227@cbmvax.commodore.com> Date: 16 Mar 90 23:33:10 GMT References: <1990Mar16.214401.1738@spectre.ccsf.caltech.edu> Reply-To: peter@cbmvax (Peter Cherna) Distribution: comp Organization: Commodore, West Chester, PA Lines: 48 In article <1990Mar16.214401.1738@spectre.ccsf.caltech.edu> bdiscoe@tybalt.caltech.edu (Ben W. Discoe) writes: >How do you Wait() on several ports simultaneously? I know how to wait on, >say, the serial device, console device and an IDCMP individually, but what >I really need to do is wait on a message from any one of them. > >I tried: waitflags = | |.... ; > Wait(waitflags); >but this didn't seem to work. You can WaitPort() on a port, but you can only Wait() on a signal. To be clear, you wait on the signal mask (for example 0000000010000000 binary) and not on the signal bit number (for example signal #7). So you see constructs like this all the time Wait( 1 << msgport->mp_SigBit ); which converts the signal bit number to a bit mask. So if you have multiple ports, say arexxport, intuiport, and timerport, you might say timermask = ( 1 << timerport->mp_SigBit ); arexxmask = ( 1 << arexxport->mp_SigBit ); intuimask = ( 1 << intuiport->mp_SigBit ); signalmask = Wait( timermask | arexxmask | intuimask ); if (signalmask & timermask) { /* got a msg at timerport */ } if (signalmask & arexxmask) { /* got a msg at arexxport */ } if (signalmask & intuimask) { /* got a msg at intuiport */ } >-Ben "But I READ the manual! Honest!" Peter -- Peter Cherna, Software Engineer, Commodore-Amiga, Inc. {uunet|rutgers}!cbmvax!peter peter@cbmvax.cbm.commodore.com My opinions do not necessarily represent the opinions of my employer.