Path: utzoo!mnetor!uunet!husc6!im4u!ut-sally!utah-cs!thomson From: thomson@utah-cs.UUCP (Richard A Thomson) Newsgroups: comp.sys.amiga.tech Subject: Re: WaitPort, GetMsg, ReplyMsg Message-ID: <5417@utah-cs.UUCP> Date: 19 Apr 88 05:37:09 GMT References: <8804182050.AA15158@cory.Berkeley.EDU> Reply-To: thomson@cs.utah.edu.UUCP (Richard A Thomson) Organization: University of Utah CS Dept Lines: 38 In article <8804182050.AA15158@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes: >:In article I (Richard Thomson) wrote: >:This tells me that after the WaitPort call, message will point to the >:first message in the list. The funny thing is that when I do a GetMsg(port) >:I get a different address, although it also is listed as returning a pointer >:to the first message in the port's message list. What's going on here? > > WaitPort() does NOT remove the message from the port. you should >NEVER ReplyMsg() without GetMsg() it first. I.E.: > > WaitPort(port); > message = GetMsg(port); > code = message->Code; > class = message->Class; > ReplyMsg(message); > > -Matt The part about WaitPort not removing the message is clear and Matt's above example is what I used, although it actually looks like this: [ FORTHer's version ] [ C hack's version :-] port GetMsg ?DUP 0= IF if ((message = GetMsg(port)) == 0) { port WaitPort DROP WaitPort(port); port GetMsg THEN message = GetMsg(port); } DUP +imCode MsgCode ! MsgCode = message->Code; DUP +imClass @ class = message->Class; SWAP ReplyMsg ReplyMsg(message); My question still remains unanswered, though. The documentation for WaitPort and GetMsg says that they both "return a pointer to the first message", but they return different pointers! -- Rich Thomson -- -- Rich Richard Thomson 3190 MEB, University of Utah, Salt Lake City, UT 84112 thomson@cs.utah.edu (801) 584-4555: Talk to a machine, they're lonely.