[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01211] Re: File#flock

From: matz@... (Yukihiro Matsumoto)
Date: 2000-01-31 15:32:54 UTC
List: ruby-talk #1211
In message "[ruby-talk:01210] Re: File#flock"
    on 00/01/31, ts <decoux@moulon.inra.fr> writes:

|Y> No, File#flock is based on system call flock(2), which does not aware
|Y> of Ruby's threads.  For thread synchronization, use Mutex.
|
| I don't understand this case :

(snip)

I see.  File#flock can be used to exclude control flow within same
process (i.e. threads),  but since threads share memory space, threads
may share locked file descriptor.  On the other hand, there's no way
to share locked file descriptor between processes, thus

|  LOCK_EX 
|
|     Exclusive lock. Only one process may hold an exclusive lock for a
|                     ^^^^^^^^^^^^^^^^
|     given file at a given time.

And not "Only one thread".
Hope this helps.

							matz.

In This Thread