Exemplo n.º 1
0
 /**
  * Returns the process ID of the script, if any.
  *
  * @access  public
  * @param   string $name The name of this lock file
  * @return  integer The process ID of the script
  */
 function getProcessID($name)
 {
     static $pids;
     // poor man's cache system
     if (!empty($pids[$name])) {
         return $pids[$name];
     }
     $pid_file = Lock::_getProcessFilename($name);
     if (!file_exists($pid_file)) {
         return 0;
     } else {
         $pids[$name] = trim(implode('', file($pid_file)));
         return $pids[$name];
     }
 }