Path: utzoo!mnetor!uunet!cbmvax!carolyn From: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Newsgroups: comp.sys.amiga Subject: Re: Need help with signals Message-ID: <3073@cbmvax.UUCP> Date: 4 Jan 88 15:29:12 GMT References: <8801030156.AA04670@cory.Berkeley.EDU> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Organization: Commodore Technology, West Chester, PA Lines: 39 In article <8801030156.AA04670@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes: > >: while(1){ >: Wait((1L << MyWindow->UserPort->mp_SigBit) | >: (1L << SerRead->mp_SigBit) | >: (1L << ConRead->mp_SigBit)); >: if(WinMsg = (struct IntuiMessage *)GetMsg(MyWindow->UserPort)){ >: mclass = WinMsg->Class; >: mcode = WinMsg->Code; >: ReplyMsg(WinMsg); >: if(mclass == CLOSEWINDOW){ >: AbortIO(ser_in); >: CloseSerial(); >: cleanup("Exiting", 0); >: break; >: } >: } >: else if(GetMsg(SerRead)){ <<<<<<<<<<<<<--- remove else >: data_in = SerGetChar(); >: PutChar(data_in); >: } >: else if(GetMsg(ConRead)){ <<<<<<<<<<<<<<-- remove else >: data_out = GetChar(); >: SerPutChar(data_out); >: } >: } I would add that for any port where multiple messages might come in (like the window's UserPort), your GetMsg line should not be an "if" but a "while". A set signal bit does not mean there is only ONE message at the port. If you don't handle them in a while loop, your program can easily get behind, especially with things like rawmouse or multiple item menu selection. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CATS >>Commodore Amiga Technical Support<< UUCP ...{allegra,ihnp4,rutgers}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=