code: public function stream_lock($operation)
      {
          if (!$this->handle) {
              return false;
          }
          self::restorePrev();
          $success = \flock($this->handle, $operation);
          self::register();
          return $success;
      }
docs: Advisory file locking
  
  @param integer $operation is one of the following:
  LOCK_SH to acquire a shared lock (reader).
  LOCK_EX to acquire an exclusive lock (writer).
  LOCK_UN to release a lock (shared or exclusive).
  
  @return boolean
  
  @see http://php.net/manual/en/streamwrapper.stream-lock.php