# std::unique_lock<Mutex>::operator bool

> C++ Atlas: `cppatlas.com/w/cpp/thread/unique_lock/operator_bool` | Source: https://en.cppreference.com/w/cpp/thread/unique_lock/operator_bool | Domain: Concurrency support | Standards: C++11

Checks whether *this owns a locked mutex or not. Effectively calls owns_lock().

## Official Specification Summary (cppreference)

```cpp
explicit operator bool() const noexcept; // (since C++11)
```

Checks whether `*this` owns a locked mutex or not. Effectively calls `owns_lock()`.

### Parameters

(none)

### Return value

`true` if `*this` has an associated mutex and has acquired ownership of it, `false` otherwise.

### See also

- [`owns_lock`](https://en.cppreference.com/w/cpp/thread/unique_lock/owns_lock): tests whether the lock owns (i.e., has locked) its associated mutex (public member function)

---
Attribution: content from https://en.cppreference.com/w/cpp/thread/unique_lock/operator_bool (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.