[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Creating a lock
- From: Glen Lee Edwards <GLEdwards uswest net>
- To: redhat-list redhat com
- Subject: Creating a lock
- Date: Fri, 18 Feb 2000 00:05:00 -0600 (CST)
I'm trying to create a lock in a Perl script using flock(). I can't get
it to work, so I need some info on how Linux handles flock (don't send me
to man - been there, done that, it was a wasted read).
We're trying to lock a file "hitcounter" before opening it by creating a
file "hitcounter.lock". The Perl experts are saying that we can then lock
hitcounter.lock, which will automitically lock hitcounter:
open S, ">hitcounter.lock" || die $!;
flock S, LOCK_EX;
open F, ">hitcounter" || die $!;
In spite of what the experts say the preceding doesn't work (I spent
several hours this evening trying it). Is there some way of telling Linux
to lock <file> with <file.lock>?
flock hitcounter LOCK_EX hitcounter.lock
???
Glen
"Freedom includes the rights of the citizens to make their own decisions
based on the information at hand and to act on those decisions."
- Jeff Van Hal
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]