[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-test-cvs
Subject:    cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm
From:       stas () apache ! org
Date:       2003-05-21 4:02:15
[Download RAW message or body]

stas        2003/05/20 21:02:14

  Modified:    perl-framework/Apache-Test/lib/Apache TestServer.pm
  Log:
  try to avoid the race condition when the pid file was created but not yet
  written to (by sleeping for fractions of a second)
  
  Revision  Changes    Path
  1.62      +8 -0      httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm
  
  Index: TestServer.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- TestServer.pm	21 Jan 2003 05:54:51 -0000	1.61
  +++ TestServer.pm	21 May 2003 04:02:14 -0000	1.62
  @@ -252,6 +252,14 @@
       open $fh, $file or do {
           return 0;
       };
  +
  +    # try to avoid the race condition when the pid file was created
  +    # but not yet written to
  +    for (1..8) {
  +        last if -s $file > 0;
  +        select undef, undef, undef, 0.25;
  +    }
  +
       chomp(my $pid = <$fh>);
       $pid;
   }
  
  
  
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic