* A Text_IO question I never dared to ask...
@ 1996-07-01 0:00 Jerry van Dijk
1996-07-02 0:00 ` James E. Hopper
0 siblings, 1 reply; 3+ messages in thread
From: Jerry van Dijk @ 1996-07-01 0:00 UTC (permalink / raw)
----------------------------
-- Stupid question ahead! --
----------------------------
This is something that has been bugging me for some time, but to which I
still cannot find a reasonable answer:
Why is there no record (or even file) locking in Text_IO ???
Ada was clearly designed be be usable in multi-tasking and even
distributed environments. But absolutely needed in such environments is
controlling file access. So why is this missing ?
Yes, I realize that the implementation of a locking mechanism is
platform dependent. But so is tasking.
Is it because Text_IO should also work on terminals ? But then why not
adding another child package that adds file locking ?
For now the only GNAT solution that has a chance for being portable is
AFAIK using something like a Posix binding. But that only seems
available for GNAT/Linux at the moment. And the standard itself is
(expensive) propriety. And why go to a external binding when for most
basic stuff the Text_IO package is perfectly usable ?
I keep wondering...
--
-----------------------------------------------------------------------
-- Jerry van Dijk -- e-mail: jerry@jvdsys.nextjk.stuyts.nl --
-- Banking Consultant -- Member Team-Ada --
-- Ordina Finance BV -- Located at Haarlem, The Netherlands --
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: A Text_IO question I never dared to ask...
1996-07-01 0:00 A Text_IO question I never dared to ask Jerry van Dijk
@ 1996-07-02 0:00 ` James E. Hopper
1996-07-03 0:00 ` Jerry van Dijk
0 siblings, 1 reply; 3+ messages in thread
From: James E. Hopper @ 1996-07-02 0:00 UTC (permalink / raw)
> >This is something that has been bugging me for some time, but to
which I >still cannot find a reasonable answer: > > Why is there no
record (or even file) locking in Text_IO ???
Actually the provinzono (spelling??) version of the pthreads that is
used in linux (and now gnat-mac) comes with threadsafe libc. among
the features of which is that the basic stdIO routines used by text_io
are all using lock, unlock calls around them. i am NOT a c or
pthreads expert but since a bug in the latest pthreads beta code made
text edit hang waiting for a missing unlock until i fixed it for the
mac version i suspect they are doing what would be expected of such
routines. i wrote a couple of tasks to intersperce text io between
two competing tasks and they appear to work correctly.
there is what proports to be a threadsafe malloc as part of this code
as well though i havent verified how well it works in a
multiprocessing environemnt at this time. I remember someone on CLA
asking after this for sun.
jim
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: A Text_IO question I never dared to ask...
1996-07-02 0:00 ` James E. Hopper
@ 1996-07-03 0:00 ` Jerry van Dijk
0 siblings, 0 replies; 3+ messages in thread
From: Jerry van Dijk @ 1996-07-03 0:00 UTC (permalink / raw)
James E. Hopper (jhopper@erinet.com) wrote:
: Why is there no record (or even file) locking in Text_IO ???
: the basic stdIO routines used by text_io
: are all using lock, unlock calls around them.
Yes, task locks. To make sure the IO routines are thread-safe.
However, this is something different from file locking, which is there to
prevent other processes to access/change the external file content behind
your back.
--
-----------------------------------------------------------------------
-- Jerry van Dijk -- e-mail: jerry@jvdsys.nextjk.stuyts.nl --
-- Banking Consultant -- Member Team-Ada --
-- Ordina Finance BV -- Located at Haarlem, The Netherlands --
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-07-03 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-01 0:00 A Text_IO question I never dared to ask Jerry van Dijk
1996-07-02 0:00 ` James E. Hopper
1996-07-03 0:00 ` Jerry van Dijk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox