Skip to main content
`Ctrl`+`K`

# VecLockReadPush

Push a read-only lock on a vector to prevent it from being written to

## Synopsis

    #include "petscvec.h"
    PetscErrorCode VecLockReadPush(Vec x)

Logically Collective

## Input Parameter

- x - the vector

## Notes

If this is set then calls to `VecGetArray()` or `VecSetValues()` or any other routines that change the vectors values will generate an error.

The call can be nested, i.e., called multiple times on the same vector, but each `VecLockReadPush()` has to have one matching `VecLockReadPop()`, which removes the latest read-only lock.

## See Also

Vectors and Parallel Data, `Vec`, `VecRestoreArray()`, `VecGetArrayRead()`, `VecLockReadPop()`, `VecLockGet()`

## Level

intermediate

## Location

src/vec/vec/interface/rvector.c

Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages