[Bio] / FigKernelPackages / FileIOFunctions.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FileIOFunctions.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10, Fri Sep 4 23:17:23 2009 UTC revision 1.11, Fri Dec 11 21:37:02 2009 UTC
# Line 1403  Line 1403 
1403          return ($NoHup,$NumberOfProcessors);          return ($NoHup,$NumberOfProcessors);
1404  }  }
1405    
 =head3 ManageFileLocking  
 Definition:  
         $model->ManageFileLocking($FileHandle,$Operation,$UseFcntl);  
 Description:  
         This function handles all file locking for the FIGMODEL package. Possible values for $Operation are:  
         LOCK_EX: exclusive lock for writing  
         LOCK_SH: shared lock for simultaneous reading  
         LOCK_UN: removes the lock  
 Example:  
 =cut  
   
 sub ManageFileLocking {  
     my($FileHandle,$Operation,$UseFcntl) = @_;  
   
         #Qualifying the filehandle  
     $FileHandle = qualify_to_ref($FileHandle, caller());  
   
         #Implementing the lock using flock  
     if (!defined($UseFcntl) || $UseFcntl == 0) {  
                 if ($Operation == LOCK_EX) {  
                         my $arg = pack("ssll", F_WRLCK, SEEK_SET, 0, 0);  
                         my $rc = fcntl($FileHandle, F_SETLKW, $arg);  
                         return $rc;  
                 } elsif ($Operation == LOCK_SH) {  
                         my $arg = pack("ssll", F_RDLCK, SEEK_SET, 0, 0);  
                         my $rc = fcntl($FileHandle, F_SETLKW, $arg);  
                         return $rc;  
                 } elsif ($Operation == LOCK_UN) {  
                         my $arg = pack("ssll", F_UNLCK, SEEK_SET, 0, 0);  
                         my $rc = fcntl($FileHandle, F_SETLKW, $arg);  
                         return $rc;  
                 }  
         } else {  
                 return CORE::flock($FileHandle, $Operation);  
         }  
 }  
   
1406  =head3 runexecutable  =head3 runexecutable
1407  Definition:  Definition:
1408          my $OutputArray = runexecutable($Command);          my $OutputArray = runexecutable($Command);

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3