Article View: comp.sys.amiga.tech
Article #2981Re: Wait()ing Peacefully
From: Stephen Orr
Date: Sun, 18 Mar 1990 15:18
Date: Sun, 18 Mar 1990 15:18
32 lines
1357 bytes
1357 bytes
>You almost had it. Instead of trying to or the bits into one flag
>to wait for, set up two flags and then or in the call to wait(), like this.
>wait1flag = <port 1's mp_SigBit>;
>wait2flag = <port 2's mp_SigBit>;
>wait(wait1flag | wait2flag);
This is functionally the same as what he was doing, please note
however that the initialization of wait1flag and wait2flag
should be
wait1flag = 1<<mp_SigBit &
wait2flag = 1<<mp_SigBit
Further the wait call (which should be capitolized) returns
a bitfield to tell you which 'waits' succeeded, the wait call
should then be
ports = Wait(wait1flag | wait2flag);
Which justifies the use of the waitnflag variables as you can
now see which port(s) succeeded with
if (ports & wait1flag) { /* do stuff */
}
if (ports & wait2flag) { /* do other stuff */
}
Note: it is very possible for more than 1 port to succeed at
the same time.
Stephen Orr
SandIsoft
Technical Details
Message-ID:
<22144@watdragon.waterloo.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watdragon!rose!sjorrReferences:
<1322@mindlink.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watdragon!rose!sjorr From: sjorr@rose.waterloo.edu (Stephen Orr) Newsgroups: comp.sys.amiga.tech Subject: Re: Wait()ing Peacefully Message-ID: <22144@watdragon.waterloo.edu> Date: 18 Mar 90 15:18:22 GMT References: <1322@mindlink.UUCP> Sender: daemon@watdragon.waterloo.edu Reply-To: sjorr@rose.waterloo.edu (Stephen Orr) Organization: U. of Waterloo, Ontario Lines: 32