code: func (fm *filesManager) lockFile(file *file) (bool, error) {
  	if atomic.CompareAndSwapInt32(&file.state, fileOpened, fileInUse) {
  		return true, nil
  	}
  	return false, fm.openFile(file)
  }
docs: // lockFile locks the given file.
  // If the file was already opened, the boolean returned is true,
  // otherwise, the file is opened and the call returns false.