home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!rat!usc!howland.reston.ans.net!paladin.american.edu!gatech!rutgers!cbmvax!peter
- From: peter@cbmvax.commodore.com (Peter Cherna)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: RKM description of WaitPort()
- Message-ID: <38419@cbmvax.commodore.com>
- Date: 8 Jan 93 17:46:54 GMT
- References: <1993Jan7.122222.9718@aristo.tau.ac.il> <38385@cbmvax.commodore.com>
- Reply-To: peter@cbmvax.commodore.com (Peter Cherna)
- Organization: Commodore-Amiga, Inc. West Chester, PA.
- Lines: 25
-
- In article <38385@cbmvax.commodore.com> peter@cbmvax.commodore.com (Peter Cherna) writes:
- >Wait() and WaitPort() clear the signal. GetMsg() does not.
-
- Let me clarify. Wait() clears the signal when it wakes up. WaitPort()
- checks to see if there are any messages present. If so, it returns
- immediately with a pointer to the first message (which you must still
- GetMsg()). The signal is not cleared. If the port is empty, then
- Wait() is called, hence the signal will be cleared.
-
- In ordinary use, you never have to worry about who clears the signals.
- It all works out if you code your Wait/GetMsg() loop in one of the
- ways that have been suggested (eg. mine or one of the several followups
- that offer techniques to deal more "fairly" with multiple ports when
- one is undergoing heavy messaging).
-
- Thanks to Ralph Babel for spotting my WaitPort() oversimplification.
-
- >Peter Cherna, User Interface Development Group, Commodore-Amiga, Inc.
-
- Peter
- --
- Peter Cherna, User Interface Development Group, Commodore-Amiga, Inc.
- {uunet|rutgers}!cbmvax!peter peter@cbmvax.commodore.com
- My opinions do not necessarily represent the opinions of my employer.
- "Never take two chronometers to sea; bring either one or three."
-