Re: Most elegant way to read to allocatable array?
- From: "James Giles" <jamesgiles@xxxxxxxxxxxxxxxx>
- Date: Thu, 25 Jan 2007 20:58:43 GMT
Jan Vorbrüggen wrote:
That would be a lock that's needed whether the I/O used unit numbers
or handles. The lock on the I/O unit table is unlocked as soon as
you've looked up the corresponding handle. Since it's only a
table lookup it's fast and no thread spends much time in that
critical section.
In addition, you could have code in the library, or even the
generated code, that cached the translation.
That would not be a good idea. At least in unix-like environments,
file handles tend to be pointers. The type is usually something like
(FILE *) in C. Caching copies of pointers is unsafe. Suppose the
file is closed through one copy: you'd have a dangling pointer to
the (now non-existent) FILE struct.
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
.
- Follow-Ups:
- Re: Most elegant way to read to allocatable array?
- From: Jan Vorbrüggen
- Re: Most elegant way to read to allocatable array?
- References:
- Most elegant way to read to allocatable array?
- From: yair999@xxxxxxxxx
- Re: Most elegant way to read to allocatable array?
- From: Michael Prager
- Re: Most elegant way to read to allocatable array?
- From: Richard Maine
- Re: Most elegant way to read to allocatable array?
- From: Dan Nagle
- Re: Most elegant way to read to allocatable array?
- From: Richard Maine
- Re: Most elegant way to read to allocatable array?
- From: Dan Nagle
- Re: Most elegant way to read to allocatable array?
- From: Richard Maine
- Re: Most elegant way to read to allocatable array?
- From: Richard Maine
- Re: Most elegant way to read to allocatable array?
- From: Pierre Asselin
- Re: Most elegant way to read to allocatable array?
- From: robert . corbett
- Re: Most elegant way to read to allocatable array?
- From: Pierre Asselin
- Re: Most elegant way to read to allocatable array?
- From: Janne Blomqvist
- Re: Most elegant way to read to allocatable array?
- From: James Giles
- Re: Most elegant way to read to allocatable array?
- From: Jan Vorbrüggen
- Most elegant way to read to allocatable array?
- Prev by Date: Re: string concatenation
- Next by Date: Re: directories creation
- Previous by thread: Re: Most elegant way to read to allocatable array?
- Next by thread: Re: Most elegant way to read to allocatable array?
- Index(es):
Relevant Pages
|