home *** CD-ROM | disk | FTP | other *** search
/ ftp.f-secure.com / 2014.06.ftp.f-secure.com.tar / ftp.f-secure.com / support / hotfix / fsis / IS-SpamControl.fsfix / iufssc / lib / Mail / SpamAssassin / Locker.pm < prev    next >
Text File  |  2006-11-29  |  2KB  |  77 lines

  1. # <@LICENSE>
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements.  See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to you under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License.  You may obtain a copy of the License at:
  8. #     http://www.apache.org/licenses/LICENSE-2.0
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # </@LICENSE>
  15.  
  16. package Mail::SpamAssassin::Locker;
  17.  
  18. use strict;
  19. use warnings;
  20. use bytes;
  21. use Fcntl;
  22.  
  23. use Mail::SpamAssassin;
  24.  
  25. use vars qw{
  26.   @ISA
  27. };
  28.  
  29. @ISA = qw();
  30.  
  31. ###########################################################################
  32.  
  33. sub new {
  34.   my $class = shift;
  35.   $class = ref($class) || $class;
  36.   my $self = { };
  37.   bless ($self, $class);
  38.   $self;
  39. }
  40.  
  41. ###########################################################################
  42.  
  43. sub safe_lock {
  44.   my ($self, $path, $max_retries, $mode) = @_;
  45.   # max_retries is optional, should default to about 30
  46.   # mode is UNIX-style and optional, should default to 0700,
  47.   # callers must specify --x bits
  48.   die "locker: safe_lock not implemented by Locker subclass";
  49. }
  50.  
  51. ###########################################################################
  52.  
  53. sub safe_unlock {
  54.   my ($self, $path) = @_;
  55.   die "locker: safe_unlock not implemented by Locker subclass";
  56. }
  57.  
  58. ###########################################################################
  59.  
  60. sub refresh_lock {
  61.   my ($self, $path) = @_;
  62.   die "locker: refresh_lock not implemented by Locker subclass";
  63. }
  64.  
  65. ###########################################################################
  66.  
  67. sub jittery_one_second_sleep {
  68.   my ($self) = @_;
  69.   select(undef, undef, undef, (rand(1.0) + 0.5));
  70. }
  71.  
  72. ###########################################################################
  73.  
  74. 1;
  75.