HP3000-L Archives

January 2003, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Roy Brown <[log in to unmask]>
Reply To:
Roy Brown <[log in to unmask]>
Date:
Tue, 14 Jan 2003 17:47:21 -0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (73 lines)
---- Original Message ----
From: "Ken Hirsch" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Tuesday, January 14, 2003 4:17 PM
Subject: Re: [HP3000-L] Message File programming

>> But in other than these cases, the FREAD will return immediately on
>> EOF anyway, with CCG(0).

>> Which is what FCONTROL 45 is there to prevent; it's actually the
>> exact opposite of what you want, as it's designed to ensure that an
>> FREAD *does* wait until a record appears (or until the timeout kicks
>> in).

> Except for the first read after you open the message file--there the
> default is for extended wait to be ON instead of OFF.

Ken's amplification alerts me that I got the para above the bit he's quoted
wrong -
the consequence of starting of by describing the negative, and then only
half-correcting it :-(

What I should have said was:

When FREAD encounters EOF, you only actually need an FCONTROL 4 timeout for
the first FREAD on your message file, or
if a writer is running. (But as you don't know if this is the case or not, in
practice you always need it).

But in other than these cases, the FREAD will return immediately on EOF
anyway, with CCG(0).

Which is what FCONTROL 45,1 is there to prevent; it's actually the exact
opposite of what you want,
as it's designed to ensure that an FREAD does wait until a record appears (or
until the timeout kicks in),
in the case where this is your second or a subsequent FREAD and there are no
writers [1].

i.e. if there are no writers, the first FREAD you issue on a message file
after the FOPEN will *never* return if the file is at EOF, unless you have
issued a prior (FCONTROL,  4, waittime) to make this FREAD time out.
However, once you have got past this first FREAD, with the timeout, subsequent
FREADs of the file at EOF will detect the absence of writers and return
immediately, without waiting for the timeout.

OTOH, if there *are* writers, the first FREAD you issue on a message file
after the FOPEN will *never* return if the file is at EOF and nobody actually
writes, unless you have issued a prior (FCONTROL,  4, waittime) to make this
FREAD time out.
But here, once you have got past this first FREAD, with the timeout,
subsequent FREADs of the file at EOF will detect the presence of writers and
wait for a record to appear, or for the waittime, whichever is the sooner, and
then return.

Bottom line? If the message file is at EOF, you need the FCONTROL 4 whatever
the circumstances, in order that the first FREAD doesn't stall, and you might
as well leave it on thereafter, so the FREADs don't stall due to quiesced
writers.


As FCONTROL 45,0  (note: I'm talking of 45 here *not* 4) is the default, I
don't think setting this is going to make any difference.



Roy Brown
Posting with the OEnemy, tamed by OE-QuoteFix 1.17.6
http://jump.to/oe-quotefix

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2