[mercury-users] File Handling predicates io__tmpnam
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Nov 7 00:02:38 AEDT 2002
Noel, the answers to many of these questions are easily obtained by
looking up the word or phrase which you do not understand
in a dictionary of computing, e.g. FOLDOC, the free on-line
dictionary of computing <http://wombat.doc.ic.ac.uk/foldoc/>.
On 06-Nov-2002, Noel Pinto <cool4life at rediffmail.com> wrote:
> 1) Does deprecate mean depreciate here?
No, deprecate is a separate word. Look it up in a dictionary.
> What I understand it means disapproved of.
Correct. It's also an indication that it may not be supported
in future releases.
> Plz tell me Why??
tmpnam/3 is deprecated because, as the comment says,
using it may result in race conditions.
> 2) What is a race condition??
According to FOLDOC:
"Anomalous behavior due to unexpected critical dependence on the
relative timing of events.
For example, if one process writes to a file while another is reading
from the same location then the data read may be the old contents, the
new contents or some mixture of the two depending on the relative timing
of the read and write operations. "
The race condition with tmpnam is that although it is documented that
tmpnam "binds `Name' to a temporary file name which is different to the
name of any existing file.", the application cannot depend on this
condition, since it may not continue to hold; another process running
in parallel could create a file with that name.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list