---
name: "std::lock_guard"
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::lock_guard/3cxx"
---

# std::lock\_guard(3cxx)

A simple scoped lock type.

## NAME

std::lock\_guard\< \_Mutex \> - A simple scoped lock type.

## SYNOPSIS

`#include <mutex>`

### Public Types

**typedef** **\_Mutex** **mutex\_type**\

### Public Member Functions

**lock\_guard** (const **lock\_guard** &)=**delete**\
 **lock\_guard** (mutex\_type &**\_\_m**)\
 **lock\_guard** (mutex\_type &**\_\_m**, **adopt\_lock\_t**) noexcept\
 **lock\_guard** & **operator=** (const **lock\_guard** &)=**delete**\

## Detailed Description

### template\<typename \_Mutex\>

class std::lock\_guard\< \_Mutex \>"A simple scoped lock type.

A lock\_guard controls mutex ownership within a scope, releasing ownership in the destructor.

**Since**

C++11

## Author

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