---
name: "std::mutex"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::mutex/3cxx"
---

# std::mutex(3cxx)

## NAME

std::mutex

## SYNOPSIS

`#include <mutex>`

Inherits \_\_mutex\_base.

### Public Types

**typedef** **\_\_native\_type** \* **native\_handle\_type**\

### Public Member Functions

**mutex** (const **mutex** &)=**delete**\
 **void** **lock** ()\
 **native\_handle\_type** **native\_handle** () noexcept\
 **mutex** & **operator=** (const **mutex** &)=**delete**\
 bool **try\_lock** () noexcept\
 **void** **unlock** ()\

## Detailed Description

The standard mutex type.

A simple, non-recursive, non-timed mutex.

Do not call `lock()` and `unlock()` directly, use a scoped lock type such as `std::unique_lock`, `std::lock_guard`, or (since C++17) `std::scoped_lock`.

**Since**

C++11

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
