[thread.req.lockable.shared]

# 32 Concurrency support library [[thread]](./#thread)

## 32.2 Requirements [[thread.req]](thread.req#lockable.shared)

### 32.2.5 Requirements for *Cpp17Lockable* types [[thread.req.lockable]](thread.req.lockable#shared)

#### 32.2.5.5 *Cpp17SharedLockable* requirements [thread.req.lockable.shared]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L344)

A type L meets the *Cpp17SharedLockable* requirements if
the following expressions are well-formed, have the specified semantics, and
the expression m.try_lock_shared() has type bool (m denotes a value of type L):

[ð](#itemdecl:1)

`m.lock_shared()
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L355)

*Effects*: Blocks until a lock can be acquired for the current execution agent[.](#2.sentence-1)

If an exception is thrown then a lock shall not have been acquired for
the current execution agent[.](#2.sentence-2)

[ð](#itemdecl:2)

`m.try_lock_shared()
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L367)

*Effects*: Attempts to acquire a lock for the current execution agent without blocking[.](#3.sentence-1)

If an exception is thrown then a lock shall not have been acquired for
the current execution agent[.](#3.sentence-2)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L373)

*Returns*: true if the lock was acquired, false otherwise[.](#4.sentence-1)

[ð](#itemdecl:3)

`m.unlock_shared()
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L383)

*Preconditions*: The current execution agent holds a shared lock on m[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L387)

*Effects*: Releases a shared lock on m held by the current execution agent[.](#6.sentence-1)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L391)

*Throws*: Nothing[.](#7.sentence-1)
