home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18375 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  1.7 KB

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