home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!gatech!concert!samba!usenet
- From: Todd_Lewis@unc.edu (Todd M. Lewis)
- Subject: Re: Aborting Timer requests
- Message-ID: <1993Jan25.140359.4296@samba.oit.unc.edu>
- Sender: usenet@samba.oit.unc.edu
- Nntp-Posting-Host: guitar.oit.unc.edu
- Organization: UNC Office of Information Technology
- References: <nsgls*pb1@wolf359.UUCP>
- Date: Mon, 25 Jan 1993 14:03:59 GMT
- Lines: 53
-
- In article <nsgls*pb1@wolf359.UUCP> eric@wolf359.UUCP (Eric Edwards) writes:
- >Can someone give me some insight on the proper way to abort a timer
- >request?
-
- Yes, use a consistent policy for handling messages to and from the
- timer device. Don't go mixing Wait() and GetMsg() with AbortIO()
- and WaitIO() unless you pay special attention to what might happen
- to the signal (as you found out). In particular:
-
- Wait() Allways clears signal(s).
- WaitIO() May or may not clear signal, depends on whether
- IO was completed already.
- WaitPort() Like WaitIO(), may or may not clear signal.
- AbortIO() Might result in signal being set if the IO had not
- already completed. Leaves signal unchanged otherwise.
- SendIO() Appears not to affect signals, but in fact does
- leave signal clear.
- DoIO() No appearant effect on signals.
-
- Note that most of the time you really don't know the state of
- a signal after one of these calls. Program defensively, being
- prepared for every case.
-
- Note that the signal associated with the reply port (or any other
- port for that matter) is optional. Note as well that the reply port
- itself is optional. Nobody does IO without a reply port and an
- associated signal, though.
-
- >My query is: Why is the signal still active after AbortIO and WaitIO?
- >What do I need to do to reset it?
-
- WaitIO() doesn't always clear out the signal bit. In fact, nothing but
- Wait( 1L<<SigBit ) and SetSignal( 0, 1L<<SigBit ) are guaranteed
- to clear them out, and the bits are not guaranteed to stay cleared,
- even as long as until the next line of code. (ppp #247: Any task
- in the system is free to set any of your signals at any moment.
- You should be prepared for that.) (ppp=paranoid programmer pragma)
-
- We tend to associate signals too closely with other things--messages
- coming in, etc., but that's a mistake. Signals only really mean
- that a signal is set. You should program as if signals are only
- suggestions that perhaps some events might have happend and
- that perhaps it would be a good thing to check on them but don't
- be surprised if it's a false alarm.
-
- You could clear the signal before you send your timer message.
- "SetSignal( 0, 1L << TimerMP->mp_SigBit )" would do it. However,
- SetSignal() is documented as being "considered dangerous" whatever
- that means.
- --
- _/_/_/ _/ Todd_Lewis@unc.edu You can lead a horse to
- _/ _/ utoddl@guitar.oit.unc.edu Mohammad, but you can't make
- _/ _/_/_/ a mountain drink a mole hill.
-