Article View: comp.sys.amiga.tech
Article #10700Re: AbortIO with Timer device
From: Matt Dillon
Date: Sun, 25 Dec 1988 07:13
Date: Sun, 25 Dec 1988 07:13
43 lines
2039 bytes
2039 bytes
>
> Does AbortIO() have an adverse effect on my communications to the timer
>device? I've tried re-opening the device with OpenDevice() but it doesn't help.
>Do I have to open a new Port to the timer device with CreatePort()?
AbortIO() causes the request to be returned to the message port but
not removed. Furthermore, AbortIO() is an advisory call to the device and
device will not abort if it cannot abort (the timer.device is able to abort
any active request so you don't have to worry about that). Thus, the
proper 'abort' sequence is:
AbortIO(timreq); /* request timer.device to abort it */
WaitIO(timreq); /* wait for it to be returned & remove it from the
* reply port
*/
Note also that the timer.device DESTROYS the time fields of the
request... To restart any request, even if it came back normally, you must
reload the fields:
timreq->tr_time.tv_secs = <blah>;
timreq->tr_time.tv_micro = <blah>;
SendIO(timreq);
...
Also remember that receiving a signal from the replyport does not
guarentee the request has been returned, always CheckIO() the request (unless
you are using the replyport to sink several requests and thus using GetMsg()).
Mask = Wait(signals...)
/* note: probably want to cache the signal bit# or mask for timreq */
if (Mask & (1 << timreq->tr_node.io_Message.mn_ReplyPort->mp_SigBit)) {
if (CheckIO(timreq) { /* request returned?*/
WaitIO(timreq); /* remove from repport */
puts("SURPRISE!");
timreq->tr_time.tv_secs = <blah>; /* restart */
timreq->tr_time.tv_micro = <blah>;
SendIO(timreq);
}
}
-Matt
Technical Details
Message-ID:
<8812250713.AA15365@postgres.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!ucbvax!POSTGRES.BERKELEY.EDU!dillonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!ucbvax!POSTGRES.BERKELEY.EDU!dillon From: dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga.tech Subject: Re: AbortIO with Timer device Message-ID: <8812250713.AA15365@postgres.Berkeley.EDU> Date: 25 Dec 88 07:13:24 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 43