[net.micro.amiga] Q on AbortIO

dillon@PAVEPAWS.BERKELEY.EDU (Matt Dillon) (05/24/86)

	Ok, AbortIO() Fails when the request has already completed.  My
question is, when I call AbortIO() and it fails, will it still remove the
request from the reply port? or do I still have to WaitIO() ??????

	Next questions:  If I call the sequence:

	AbortIO();
	WaitIO();

	Will WaitIO() do the right thing when AbortIO() WORKS (e.g. actually
	aborts the IO)

Serial Driver:
	When AbortIO()ing read requests, is it possible to loose characters?
That is, if I abort a read request and it has already read 5 characters, will
io_Actual be 5 (so I can still get at what was read before the abort)?  Or
will it throw the chars away.





						-Matt

neil@amiga.UUCP (Neil Katin) (05/27/86)

In article <8605232153.AA01439@pavepaws> dillon@PAVEPAWS.BERKELEY.EDU (Matt Dillon) writes:
>
>	Ok, AbortIO() Fails when the request has already completed.  My
>question is, when I call AbortIO() and it fails, will it still remove the
>request from the reply port? or do I still have to WaitIO() ??????

AbortIO NEVER removes the request from the reply port.  All it does
is try and get the device to stop processing the request.  If the
request was actually aborted then the io_Error field will be set
to a characteristic value.

Also note that AbortIO() is not guaranteed to abort the IO immediately.
The device may be committed to completing that operation, and be too
involved to back out of the transaction.

>	Next questions:  If I call the sequence:
>
>	AbortIO();
>	WaitIO();
>
>	Will WaitIO() do the right thing when AbortIO() WORKS (e.g. actually
>	aborts the IO)

Yes.

	Neil Katin
	Commodore-Amiga

randy@cbmvax.cbm.UUCP (Randy Weiner) (05/27/86)

In article <8605232153.AA01439@pavepaws> dillon@PAVEPAWS.BERKELEY.EDU.UUCP writes:
>	Ok, AbortIO() Fails when the request has already completed.  My
>question is, when I call AbortIO() and it fails, will it still remove the
>request from the reply port? or do I still have to WaitIO() ??????
>
	AbortIO only removes the request from the device queue, not
from the reply queue. A reply is posted as if the IO had completed.
The FLAG field is set to indicate an error (non-zero) and the IO_ERROR
field has the IOERR_ABORTED bit set.

	In this case, since the request has already completed, the 
AbortIO fails and the flag field is 0. You should receive your reply
in the expected fashion, meaning WaitIO should catch the almost
aborted but completed request. You must still remove the reply
(GetMsg(xxx)) yourself as WaitIO never removes a reply.

>	Next questions:  If I call the sequence:
>
>	AbortIO();
>	WaitIO();
>
>	Will WaitIO() do the right thing when AbortIO() WORKS (e.g. actually
>	aborts the IO)
>
	It should work because the AbortIO merely causes the specified 
request to terminate early and a reply to be posted to the ReplyPort.
Remember to check the IO_Error field on all IO completions so you can
be sure of its cause.

>Serial Driver:
>	When AbortIO()ing read requests, is it possible to loose characters?
>That is, if I abort a read request and it has already read 5 characters, will
>io_Actual be 5 (so I can still get at what was read before the abort)?  Or
>will it throw the chars away.
>
	You should be able to read the characters already read.
AbortIO for the Serial device merely stops further IO from taking
place. In the case of a read, the IO_Error field is set to indicate
an abort, but the other fields are left intact. The information already
there should remain. 


-- 
     + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
Randy Weiner -- Commodore Business Machines <<Amiga Technical Support>>
		uucp: {ihnp4|seismo|caip}!cbmvax!randy
		arpa: cbmvax!randy@seismo
		(or)  randy@cbmvax.UUCP@{seismo | harvard}
		TEL:  215-431-9180

ewhac@well.UUCP (05/29/86)

-- REPLACE THIS LINE WITH ANOTHER EXACLY LIKE IT --
In article <297@cbmvax.cbmvax.cbm.UUCP> randy@cbmvax.UUCP (Randy Weiner) writes:
>In article <8605232153.AA01439@pavepaws> dillon@PAVEPAWS.BERKELEY.EDU.UUCP writes:
>>	Ok, AbortIO() Fails when the request has already completed.  My
>>question is, when I call AbortIO() and it fails, will it still remove the
>>request from the reply port? or do I still have to WaitIO() ??????
>>
>	AbortIO only removes the request from the device queue, not
>from the reply queue. A reply is posted as if the IO had completed.
>The FLAG field is set to indicate an error (non-zero) and the IO_ERROR
>field has the IOERR_ABORTED bit set.
>
>	In this case, since the request has already completed, the 
>AbortIO fails and the flag field is 0. You should receive your reply
>in the expected fashion, meaning WaitIO should catch the almost
>aborted but completed request. You must still remove the reply
>(GetMsg(xxx)) yourself as WaitIO never removes a reply.
			   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [ ... ]

	WHAT??!!  Are you *ABSOLUTELY* sure about this one?  I distinctly
remember reading in the RKM that WaitIO() does use the reply port:

-------- Excerpt from Rom Kernel Manual, version >> 1.0 <<, p. 6-6

	WaitIO, as with DoIO, also internally uses the ReplyPort.  If you
use WaitIO, it will not be necessary to use GetMsg after your task awakens.

--------

	Yes, I still have my 1.0 manual; it has some things in it (believe
it or not) that don't appear in the 1.1 manual, such as the above
clarification on how I/O works.

	Please, Commodore.  Try to be correct.  It *IS* your machine, after
all.  If I'm wrong, feel free to flame me.

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab				ihnp4!ptsfa!well!ewhac
						..or..
I don't work for anybody,		well ---\
so I don't need disclaimers!		dual ----> !unicom!ewhac
					hplabs -/       ("AE-wack")

neil@amiga.UUCP (Neil Katin) (05/30/86)

In article <1174@well.UUCP> ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
>In article <297@cbmvax.cbmvax.cbm.UUCP> randy@cbmvax.UUCP (Randy Weiner) writes:
>>	In this case, since the request has already completed, the 
>>AbortIO fails and the flag field is 0. You should receive your reply
>>in the expected fashion, meaning WaitIO should catch the almost
>>aborted but completed request. You must still remove the reply
>>(GetMsg(xxx)) yourself as WaitIO never removes a reply.
>			   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> [ ... ]
>
>	WHAT??!!  Are you *ABSOLUTELY* sure about this one?  I distinctly
>remember reading in the RKM that WaitIO() does use the reply port:
>

Yes, you are correct.  WaitIO DOES remove the request.  Sorry about the
mistake.

	Neil Katin
	Commodore-Amiga Inc.
	amiga!neil

phil@scubed.UUCP (Phil Cohen) (05/30/86)

This line of discussion reminds me of an unresolved question raised
by Leo's tutorial on multitasking.  After his example program exits,
my Amiga gets a guru meditation.  Has this been resolved?  

The code works, just leaves the machine ill. 

Phil