Hi!
Could you please give me a hint how in Ruby
to open a file with exclusive lock?
As I know, in perl it is something like this:
open F, "filename";
flock F, 2
Thanks a lot!
···
--
s&g
Hi!
Could you please give me a hint how in Ruby
to open a file with exclusive lock?
As I know, in perl it is something like this:
open F, "filename";
flock F, 2
Thanks a lot!
--
s&g
File.open "filename" do |f|
f.flock LOCK_EX
...
end
On Wed, 12 Jan 2005 00:11:19 +0900, Sea&Gull <v@vsu.ru> wrote:
Hi!
Could you please give me a hint how in Ruby
to open a file with exclusive lock?As I know, in perl it is something like this:
open F, "filename";
flock F, 2Thanks a lot!
--
s&g
--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"
Actually, that should be File::LOCK_EX.
On Tue, 11 Jan 2005 10:19:57 -0500, Bill Atkins <batkins57@gmail.com> wrote:
File.open "filename" do |f|
f.flock LOCK_EX
...
endOn Wed, 12 Jan 2005 00:11:19 +0900, Sea&Gull <v@vsu.ru> wrote:
> Hi!
>
> Could you please give me a hint how in Ruby
> to open a file with exclusive lock?
>
> As I know, in perl it is something like this:
>
> open F, "filename";
> flock F, 2
>
> Thanks a lot!
>
> --
> s&g
>
>--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"
--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"