Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!bj From: bj@cbmvax.commodore.com (Brian Jackson) Newsgroups: comp.sys.amiga.programmer Subject: Re: Question on AbortIO() and WaitIO() Message-ID: <21785@cbmvax.commodore.com> Date: 22 May 91 03:07:56 GMT References: <28630@uflorida.cis.ufl.EDU> <7753@ecs.soton.ac.uk> Reply-To: bj@cbmvax.commodore.com (Brian Jackson) Organization: Commodore, West Chester, PA Lines: 58 In article <7753@ecs.soton.ac.uk> efp90@ecs.soton.ac.uk (Pritchard EF) writes: >leh@otter.cis.ufl.edu (Les Hill) writes: > >>I have run into a situation which is not clearly documented (to me anyways) in the >>RKM's (v1.2 ?). Below I have included the relevant fragments of code: >>... >> struct MsgPort *read_port, *write_port; >> struct IOExtSer *read_req, *write_req; >>... >> BYTE dev_error; >> struct Message *read_msg; >>... >> /* Clean up */ >> if (!CheckIO(read_req)) { >> AbortIO(read_req); >> if (dev_error = WaitIO(read_req)) { ^^^^^^^^^^^^^^^^^ >> printf("Error waiting for aborted read -- %d\n", dev_error); >> goto cleanup_8; >> } >> read_msg = GetMsg(read_port); // not necessary? >> } >>... > >>The situation is this: a CMD_READ request *should* be queued at the device >>(the CheckIO() should confirm this), the CMD_READ request is then aborted and >>a WaitIO() follows as recommended in the RKMs; the WaitIO() returns a -2 >>(aborted request.) > >>The question that comes to mind is: does WaitIO() dequeue the reply at >>read_port (read_port is the reply port for read_req) regardless of the error? >>Additionally, do I need the GetMsg()? > >Look in the Revised and Updated RKM Libraries and Devices, page 292 >under AbortIO(), it states that: > >The AbortIO() command may fail; if it succeeds, the device will stop >processing the IORequest, and >** reply to it earlier than it may have done otherwise. AbortIO() does not >** remove the IORequest from your replyport... your program must wait for the >** reply message before actually reusing the IORequest... >** If a request has already completed... no action is taken. > >So YES, GetMsg() is required >Hope that helps! The GetMsg() is *not* required. He is (properly) doing a WaitIO() after the AbortIO() call and WaitIO() *does* remove the message. >E.F.Pritchard. Brian ----------------------------------------------------------------------- | Brian Jackson Software Engineer, Commodore-Amiga Inc. GEnie: B.J. | | bj@cbmvax.cbm.commodore.com or ...{uunet|rutgers}!cbmvax!bj | | "Sometimes the hamster falls asleep inside the little wheel..." | -----------------------------------------------------------------------