# VecLockGet
Gets the current lock status of a vector 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecLockGet(Vec x, PetscInt *state)
```
Logically Collective


## Input Parameter

- ***x -*** the vector



## Output Parameter

- ***state -*** greater than zero indicates the vector is locked for read; less then zero indicates the vector is
locked for write; equal to zero means the vector is unlocked, that is, it is free to read or write.





## See Also
 [](chapter_vectors), `Vec`, `VecRestoreArray()`, `VecGetArrayRead()`, `VecLockReadPush()`, `VecLockReadPop()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/rvector.c.html#VecLockGet">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)  
