---
name: "std::shared_lock"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::shared_lock"
---

# std::shared\_lock(3)

shared\_lock

## NAME

std::shared\_lock\< \_Mutex \> - shared\_lock

## SYNOPSIS

\#include \<shared\_mutex\>

### Public Types

typedef \_Mutex **mutex\_type**\

### Public Member Functions

**shared\_lock** (mutex\_type &\_\_m)\
 **shared\_lock** (mutex\_type &\_\_m, **adopt\_lock\_t**)\
 template\<typename \_Rep, typename \_Period\> **shared\_lock** (mutex\_type &\_\_m, const **chrono::duration**\< \_Rep, \_Period \> &\_\_rel\_time)\
 template\<typename \_Clock, typename \_Duration\> **shared\_lock** (mutex\_type &\_\_m, const **chrono::time\_point**\< \_Clock, \_Duration \> &\_\_abs\_time)\
 **shared\_lock** (mutex\_type &\_\_m, **defer\_lock\_t**) noexcept\
 **shared\_lock** (mutex\_type &\_\_m, **try\_to\_lock\_t**)\
 **shared\_lock** (shared\_lock &&\_\_sl) noexcept\
 **shared\_lock** (shared\_lock const &)=delete\
 void **lock** ()\
 mutex\_type \* **mutex** () const noexcept\
 **operator bool** () const noexcept\
 shared\_lock & **operator=** (shared\_lock &&\_\_sl) noexcept\
 shared\_lock & **operator=** (shared\_lock const &)=delete\
 bool **owns\_lock** () const noexcept\
 mutex\_type \* **release** () noexcept\
 void **swap** (shared\_lock &\_\_u) noexcept\
 bool **try\_lock** ()\
 template\<typename \_Rep, typename \_Period\> bool **try\_lock\_for** (const **chrono::duration**\< \_Rep, \_Period \> &\_\_rel\_time)\
 template\<typename \_Clock, typename \_Duration\> bool **try\_lock\_until** (const **chrono::time\_point**\< \_Clock, \_Duration \> &\_\_abs\_time)\
 void **unlock** ()\

## Detailed Description

### template\<typename \_Mutex\>

class std::shared\_lock\< \_Mutex \>"shared\_lock

## Author

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