[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:02075] Re: Lockfiles

From: kjana@... (YANAGAWA Kazuhisa)
Date: 2000-03-22 12:35:20 UTC
List: ruby-talk #2075
In message <s8d7897b.039@email1.cuna.com>
DDouthitt@cuna.com writes:

> This is not guaranteed to work.  This shows the danger of locks: in the
> time between the test (File.exist?) and the creation (File.open) someone
> else could interfere, and a lock could already be there when File.open
> is reached.

....And same is true when system is used.  Why can you believe a file
existence check and a creation in the shell are atomic?

File locking are usually implemented with atomic operations such as
symlink or mkdir.  These operations are atomic --- an existence check
and a creation of a named symbolic link/directory can not be interrupted
by any process.

# I can not explain any implementation of these are atomic, but
# usually we can believe they are.


In unix-like systems, symlink is preferred since it can make a
symbolic link to any file --- even non existent or it can not exist in
a file system.  However if extreme portability is necessary, only
mkdir can be candidate of lock operation.


-- 
kjana@os.xaxon.ne.jp                                 March 22, 2000
What is done can't be undone.

In This Thread

Prev Next