[Info-vax] Volatile, was: Re: yet another sys$qiow question
Johnny Billquist
bqt at softjar.se
Fri Aug 28 10:36:13 EDT 2015
On 2015-08-27 17:39, JF Mezei wrote:
> On 15-08-27 05:45, Johnny Billquist wrote:
>
>> Polled I/O is not a sane way to go.
>
> Yes it is, if you're on DOS on an 8086 that has no power management
> features and consumes as much power whether you are in an infinite loop
> checking the IOSB or infinite loop waiting for something else :-)
Still a bad idea.
>> WIth ASTs or event flags, you
>> normally do not "monitor" them. You just wait until they happen.
>
> However, here is one legit possibility:
>
> A timer expires, so you then check the IOSB for the IO to ensure it
> truly hasn't completed yet and if still null, you do the $CANCEL thing.
Yes.
> (purists will say that you should check event flag for the IO instead of
> IOSB, but it appears that many accept checking for non-zero IOSB to do
> the job).
Checking the event flags is no more valid than checking the IOSB, and is
way costlier.
Also, a "clever" programmer might do the QIO and the timer use the same
event flag, and then you just wait for one event flag. When it is set,
you check the IOSB to see if the I/O completed.
> Note that this would be a one time check, so not likely to trigger the
> "volatile" check, but could have some race condition if IO completes
> between the timer AST being started and you checking the IOSB inside
> that AST.
There are numerous potential pitfalls if the IOSB is not declared
volatile. I'm surprised people still think that it's a good idea *ever*
to not declare it volatile. It is just plain wrong, and will potentially
bite you in the future.
Johnny
More information about the Info-vax
mailing list