Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!carolyn From: carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) Newsgroups: comp.sys.amiga.programmer Subject: Re: Question on AbortIO() and WaitIO() Message-ID: <21757@cbmvax.commodore.com> Date: 20 May 91 23:14:26 GMT References: <28630@uflorida.cis.ufl.EDU> Reply-To: carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) Organization: Commodore, West Chester, PA Lines: 62 In article <28630@uflorida.cis.ufl.EDU> 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()? NAME WaitIO -- wait for completion of an I/O request SYNOPSIS error = WaitIO(iORequest) D0 A1 BYTE WaitIO(struct IORequest *); FUNCTION This function waits for the specified I/O request to complete, then removes it from the replyport. If the I/O has already completed, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this function will return immediately. If you KNOW there is an outstanding request, I believe the best action is: if(!CheckIO(ioreq)) AbortIO(ioreq); WaitIO(ioreq); Then regardless of whether the request had already completed, it any signal it generated will be cleared and it will be removed from the port. -- ========================================================================== Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn carolyn@commodore.com Spice up old code with a dazzling array of pointers to void functions. ==========================================================================