4 |
# Author : Ulrich Pfeifer |
# Author : Ulrich Pfeifer |
5 |
# Created On : Thu Aug 8 13:05:10 1996 |
# Created On : Thu Aug 8 13:05:10 1996 |
6 |
# Last Modified By: Ulrich Pfeifer |
# Last Modified By: Ulrich Pfeifer |
7 |
# Last Modified On: Sun Nov 12 17:51:56 2000 |
# Last Modified On: Tue Nov 14 16:19:17 2000 |
8 |
# Language : CPerl |
# Language : CPerl |
9 |
# Update Count : 148 |
# Update Count : 149 |
10 |
# Status : Unknown, Use with caution! |
# Status : Unknown, Use with caution! |
11 |
# |
# |
12 |
# Copyright (c) 1996-1997, Ulrich Pfeifer |
# Copyright (c) 1996-1997, Ulrich Pfeifer |
381 |
} |
} |
382 |
require WAIT::InvertedIndex; |
require WAIT::InvertedIndex; |
383 |
} |
} |
384 |
|
|
385 |
|
$self->getlock($self->{mode}); |
386 |
|
|
387 |
unless (defined $self->{dbh}) { |
unless (defined $self->{dbh}) { |
388 |
if ($USE_RECNO) { |
if ($USE_RECNO) { |
389 |
$self->{dbh} = tie(@{$self->{db}}, 'DB_File', $file, |
$self->{dbh} = tie(@{$self->{db}}, 'DB_File', $file, |
395 |
} |
} |
396 |
} |
} |
397 |
|
|
|
$self->getlock($self->{mode}); |
|
398 |
|
|
399 |
$self; |
$self; |
400 |
} |
} |
663 |
# If a "write" lock is requested, an existing "read" lock will be |
# If a "write" lock is requested, an existing "read" lock will be |
664 |
# released. If a "read" lock ist requested, an existing "write" lock |
# released. If a "read" lock ist requested, an existing "write" lock |
665 |
# will be released. Requiring a lock already hold has no effect. |
# will be released. Requiring a lock already hold has no effect. |
666 |
|
|
667 |
sub getlock { |
sub getlock { |
668 |
my ($self, $mode) = @_; |
my ($self, $mode) = @_; |
669 |
|
|
670 |
my $lockmgr = LockFile::Simple->make(-autoclean => 1); |
# autoclean cleans on DESTROY, stale sends SIGZERO to the owner |
671 |
|
# |
672 |
|
my $lockmgr = LockFile::Simple->make(-autoclean => 1, -stale => 1); |
673 |
my $file = $self->{file} . '/records'; |
my $file = $self->{file} . '/records'; |
674 |
my $lockdir = $self->{file} . '/read'; |
my $lockdir = $self->{file} . '/read'; |
675 |
|
|