original_string: public static function escalateReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory)
      {
          self::_startReadLockProcessing($lockDirectory);
  
          $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE);
  
          // First, release the shared lock for the benefit of GFS since
          // it will fail the conditional request to promote the lock to
          // "exclusive" while the shared lock is held (even when we are
          // the only holder).
          $lock->unlock();
  
          // GFS is really poor.  While the above "unlock" returns, GFS
          // doesn't clean up it's tables right away (which will potentially
          // cause the conditional locking for the "exclusive" lock to fail.
          // We will retry the conditional lock request several times on a
          // failure to get past this.  The performance hit is negligible
          // in the grand scheme of things and only will occur with GFS
          // filesystems or if another local process has the shared lock
          // on local filesystems.
          for ($retries = 0; $retries < 10; $retries++) {
              if ($lock->lock(LOCK_EX, true)) {
                  // Exclusive lock is obtained!
                  self::_stopReadLockProcessing($lockDirectory);
                  return true;
              }
  
              // wait 1 microsecond
              usleep(1);
          }
  
          // Restore lock state
          $lock->lock(LOCK_SH);
  
          self::_stopReadLockProcessing($lockDirectory);
          return false;
      }
code: public static function escalateReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory)
      {
          self::_startReadLockProcessing($lockDirectory);
  
          $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE);
  
          // First, release the shared lock for the benefit of GFS since
          // it will fail the conditional request to promote the lock to
          // "exclusive" while the shared lock is held (even when we are
          // the only holder).
          $lock->unlock();
  
          // GFS is really poor.  While the above "unlock" returns, GFS
          // doesn't clean up it's tables right away (which will potentially
          // cause the conditional locking for the "exclusive" lock to fail.
          // We will retry the conditional lock request several times on a
          // failure to get past this.  The performance hit is negligible
          // in the grand scheme of things and only will occur with GFS
          // filesystems or if another local process has the shared lock
          // on local filesystems.
          for ($retries = 0; $retries < 10; $retries++) {
              if ($lock->lock(LOCK_EX, true)) {
                  // Exclusive lock is obtained!
                  self::_stopReadLockProcessing($lockDirectory);
                  return true;
              }
  
              // wait 1 microsecond
              usleep(1);
          }
  
          // Restore lock state
          $lock->lock(LOCK_SH);
  
          self::_stopReadLockProcessing($lockDirectory);
          return false;
      }
code_tokens: public static function escalateReadLock ( Zend_Search_Lucene_Storage_Directory $ lockDirectory ) { self :: _startReadLockProcessing ( $ lockDirectory ) ; $ lock = $ lockDirectory -> getFileObject ( self :: READ_LOCK_FILE ) ; // First, release the shared lock for the benefit of GFS since // it will fail the conditional request to promote the lock to // "exclusive" while the shared lock is held (even when we are // the only holder). $ lock -> unlock ( ) ; // GFS is really poor.  While the above "unlock" returns, GFS // doesn't clean up it's tables right away (which will potentially // cause the conditional locking for the "exclusive" lock to fail. // We will retry the conditional lock request several times on a // failure to get past this.  The performance hit is negligible // in the grand scheme of things and only will occur with GFS // filesystems or if another local process has the shared lock // on local filesystems. for ( $ retries = 0 ; $ retries < 10 ; $ retries ++ ) { if ( $ lock -> lock ( LOCK_EX , true ) ) { // Exclusive lock is obtained! self :: _stopReadLockProcessing ( $ lockDirectory ) ; return true ; } // wait 1 microsecond usleep ( 1 ) ; } // Restore lock state $ lock -> lock ( LOCK_SH ) ; self :: _stopReadLockProcessing ( $ lockDirectory ) ; return false ; }
docstring: Escalate Read lock to exclusive level
  
  @param  Zend_Search_Lucene_Storage_Directory $lockDirectory
  @return boolean
docstring_tokens: Escalate Read lock to exclusive level