# VecLockReadPush
Pushes a read-only lock on a vector to prevent it from writing 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecLockReadPush(Vec x)
```
Logically Collective on Vec


## 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 fail.

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




## See Also
 `VecRestoreArray()`, `VecGetArrayRead()`, `VecLockReadPop()`, `VecLockGet()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/rvector.c.html#VecLockReadPush">src/vec/vec/interface/rvector.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/rvector.c)


[Index of all Vec routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
