🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #2332

Re: Aborting TimerReq (answer and a question)

#2332
From: Hans Ridder
Date: Sat, 25 Nov 1989 18:25
38 lines
2298 bytes
In article <1498.AA1498@julie> mcr@julie.UUCP (Michael Richardson) writes:
>  Hmm. I believe that WaitIO() doesn't call Wait() if the request has
>already arrived. I would expect that it checks the ln_Node member for
>NT_REPLY, and if found Remove()s the entry from whatever message queue
>it is on. If not it Wait()s for the signal, and does the check again.

That is basically correct, WaitIO() doesn't call Wait() unless the
IOF_QUICK bit is clear *and* the node type is *other than* NT_REPLY.

The IOF_QUICK bit indicates that the request was completed quickly,
and thus the device did not do a ReplyMsg().  The node type NT_REPLY
indicates that the request was *not* completed quickly, but the device
has completed it, and used ReplyMsg() to send it back to you.  Either
way, the request is complete and there is no need for WaitIO() to
Wait().

>Why a Wait() _after_ the WaitIO() request doesn't block, I'm not sure...

The signal bit was probably left on because the device did a
ReplyMsg(), but WaitIO() never called Wait(), so the mn_ReplyPorts's
signal bit was never cleared, but you can't rely on this!  Your
program will probably hang under certain (hard to reproduce)
conditions.  The moral is: Don't call Wait() to wait for the
mn_ReplyPort's signal because it might or might not have been cleared
(or even set if the request was completed quick).

In summary, WaitIO() knows how IO works so you don't need to.  You can
ignore all these details about IO handling if you remember what Bob
Burns pointed out in an earlier followup.  To abort IO requests (yes,
even timer.device requests):

	AbortIO(Req);
	(void)WaitIO(Req);

The (void) above indicates that we don't care what the result
(io_Error) of the request was.

-hans
Technical Details
Message-ID: <496@shodha.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!haven!decuac!shlump.nac.dec.com!shodha.dec.com!elvira!ridder
References: <4499@blake.acs.washington.edu> <1498.AA1498@julie>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!haven!decuac!shlump.nac.dec.com!shodha.dec.com!elvira!ridder
From: ridder@elvira.enet.dec.com (Hans Ridder)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Aborting TimerReq (answer and a question)
Keywords: timer.device AbortIO() WaitIO() Wait()
Message-ID: <496@shodha.dec.com>
Date: 25 Nov 89 18:25:44 GMT
References: <4499@blake.acs.washington.edu> <1498.AA1498@julie>
Sender: news@shodha.dec.com
Organization: Digital Equipment Corporation, Customer Support Center
Lines: 38