# ReentrantLock

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-headless-vnc/remote_viewing/utility/struct-reentrantlock/

**struct** · [`ferroui-headless-vnc`](/docs/0.5.0/api/ferroui-headless-vnc/) · v0.5.0

```rust
struct ReentrantLock
```

A reentrant lock without data.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/utility/reentrant_lock.rs#L17)

## Members

- [`new`](#function-new)
- [`lock`](#function-lock)
- [`is_held_by_current_thread`](#function-is_held_by_current_thread)

<a id="function-new"></a>

### new

```rust
fn new() -> Self
```

A new lock that no thread holds.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/utility/reentrant_lock.rs#L28)

<a id="function-lock"></a>

### lock

```rust
fn lock(self: &Self) -> ReentrantLockGuard<'_>
```

Takes the lock, waiting while another thread holds it. The thread
that holds it takes it again at once.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/utility/reentrant_lock.rs#L34)

<a id="function-is_held_by_current_thread"></a>

### is_held_by_current_thread

```rust
fn is_held_by_current_thread(self: &Self) -> bool
```

Whether the current thread holds the lock.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless.Vnc/remote_viewing/utility/reentrant_lock.rs#L60)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Same`
- `Default`
- `ErasedDestructor`
- `IntoEither`

## Availability

Extracted for `x86_64-unknown-linux-gnu`, `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
