Path: utzoo!mnetor!uunet!husc6!think!ames!ucbcad!ucbvax!CORY.BERKELEY.EDU!dillon
From: dillon@CORY.BERKELEY.EDU (Matt Dillon)
Newsgroups: comp.sys.amiga
Subject: Re: Need help with disk, timer I/O.
Message-ID: <8712111658.AA18522@cory.Berkeley.EDU>
Date: 11 Dec 87 16:58:41 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 54


>Since this may or may not be a hardware problem on my system, I thought I'd
>handle the problem by doing asynchronous I/O to the disk drive and using
>an async timer, then Wait for either to complete.  This is where things

	If other formats work, then I doubt it is a hardware problem.  I
suggest a bug in your code.  The proper way to fix it is to do more testing.
Using a 'timeout and assume it worked' method is *very bad* programming
technique.

:SendIO(disk request)
:SendIO(timer request)
:
:signals = Wait(diskBit | timerBit)
:
:if (signals & timerBit) {
:	We had a timeout...set timeout flag
:}
:else
:	Abort timer request (AbortIO)
:
:GetMsg(timer request)	/* pull timer reply from reply port */
:
:if ( ! (signals & diskBit) ) {
:	Disk I/O didn't complete - abort it.
:}
:
:GetMsg(disk request)	/* pull disk reply from reply port */

>Does anyone see anything wrong with the above "logic" or should I be aware

	The code is all wrong! (unless you didn't include something I
should know about!).

	(1) If the disk request completes first the only signal you get is
	    diskBit... BUT the timer CAN complete just after that but BEFORE
	    you AbortIO() the timer request... meaning the signal gets set
	    and the NEXT Wait() returns immediately even if the next timer
	    request isn't through.

	(2) You GetMsg() the request?  WHAT?  The request is NOT a message
	    port... you CANNOT GetMsg() IT!!!!...  Properly, you WaitPort()
	    on the port the message will be replied to, and then GetMsg() from
	    the port or simply Remove() the message.

	(3) The same illegal signal procedure might also be happenning with
	    your disk request... and you are also GetMsg()ing that which is
	    wrong.  The fix is to use SetSignal() to CLEAR THE TWO SIGNALS
	    BEFORE DISPATCHING THE IOREQUESTS.


					Hope this helps,

					-Matt