[Info-vax] yet another sys$qiow question
VAXman- at SendSpamHere.ORG
VAXman- at SendSpamHere.ORG
Fri Aug 21 14:37:16 EDT 2015
In article <bf891283-3972-4733-befd-268045556121 at googlegroups.com>, John Reagan <xyzzy1959 at gmail.com> writes:
>On Friday, August 21, 2015 at 8:57:45 AM UTC-4, Craig A. Berry wrote:
>> On 8/21/15 7:19 AM, Johnny Billquist wrote:
>> > On 2015-08-21 14:07, David Froble wrote:
>>=20
>> >> Thanks for validating Craig's statement. You don't test the IOSB for
>> >> completion. If you're doing async I/O, then you wait for the AST or
>> >> whatever to tell you it's complete.
>> >
>> > Are you saying that it is a poorly written program if it do not use AST=
>s???
>>=20
>> It's poorly written if it does not use a documented method to make sure
>> the I/O completes *before* reading the value of the IOSB, a point I have
>> made and you have ignored multiple times. ASTs are one of the documented
>> methods.
>>=20
>> > My example code will wait on the event flag. And it will fail if you
>> > don't declare the iosb as volatile.
>>=20
>> There is no event flag in your sample code, which consisted in its=20
>> entirety of:
>>=20
>> SYS$QIO(<arguments>);
>> if (iosb =3D=3D 0) {
>> <do some stuff>
>> <wait for I/O completion>
>> printf("IOSB is now %x\n", iosb);
>> }
>>=20
>> Unless "wait for I/O completion" means wait for an event flag? If it
>> means SYS$SYNCH, then you'd be fine because that takes the address of
>> the IOSB and the compiler would know someone else might modify it. If it
>> is an event flag firing then yes, the printf might say iosb is zero even
>> though it changed in the meantime, but only because you checked its
>> value before ensuring that the I/O completed. Which is wrong, so don't
>> do that.
>
>Since the IOSB was passed to $QIO, the compiler now worries that $QIO saved=
> the address (it did). If you call $WAITFR, the compiler would be worried =
>that $WAITFR has access to the saved IOSB address. I would expect the IOSB=
> to be refetched for that printf. (The compiler DOES know about RTL routin=
>es like printf that don't have side-effects.)
For that worried compiler:
https://www.youtube.com/watch?v=Rdk-rHAndNc
--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)ORG
I speak to machines with the voice of humanity.
More information about the Info-vax
mailing list