[thread.req.lockable.general]

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

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

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

#### 32.2.5.1 General [thread.req.lockable.general]

[1](#1)

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

An [*execution agent*](#def:execution_agent "32.2.5.1 General [thread.req.lockable.general]") is an entity such as a thread that may perform work in parallel with
other execution agents[.](#1.sentence-1)

[*Note [1](#note-1)*:

Implementations or users can introduce other kinds of
agents such as processes or thread-pool tasks[.](#1.sentence-2)

â *end note*]

The calling agent is determined by
context, e.g., the calling thread that contains the call, and so on[.](#1.sentence-3)

[2](#2)

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

[*Note [2](#note-2)*:

Some lockable objects are âagent obliviousâ in that they work for any
execution agent model because they do not determine or store the agent's ID (e.g., an
ordinary spin lock)[.](#2.sentence-1)

â *end note*]

[3](#3)

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

The standard library templates unique_lock ([[thread.lock.unique]](thread.lock.unique "32.6.5.4 Class template unique_­lock")),shared_lock ([[thread.lock.shared]](thread.lock.shared "32.6.5.5 Class template shared_­lock")),scoped_lock ([[thread.lock.scoped]](thread.lock.scoped "32.6.5.3 Class template scoped_­lock")),lock_guard ([[thread.lock.guard]](thread.lock.guard "32.6.5.2 Class template lock_­guard")), lock,try_lock ([[thread.lock.algorithm]](thread.lock.algorithm "32.6.6 Generic locking algorithms")), andcondition_variable_any ([[thread.condition.condvarany]](thread.condition.condvarany "32.7.5 Class condition_­variable_­any")) all operate on user-supplied
lockable objects[.](#3.sentence-1)

The [*Cpp17BasicLockable*](thread.req.lockable.basic#:Cpp17BasicLockable "32.2.5.2 Cpp17BasicLockable requirements [thread.req.lockable.basic]") requirements, the [*Cpp17Lockable*](thread.req.lockable.req#:Cpp17Lockable "32.2.5.3 Cpp17Lockable requirements [thread.req.lockable.req]") requirements,
the [*Cpp17TimedLockable*](thread.req.lockable.timed#:Cpp17TimedLockable "32.2.5.4 Cpp17TimedLockable requirements [thread.req.lockable.timed]") requirements,
the [*Cpp17SharedLockable*](thread.req.lockable.shared#:Cpp17SharedLockable "32.2.5.5 Cpp17SharedLockable requirements [thread.req.lockable.shared]") requirements, and
the [*Cpp17SharedTimedLockable*](thread.req.lockable.shared.timed#:Cpp17SharedTimedLockable "32.2.5.6 Cpp17SharedTimedLockable requirements [thread.req.lockable.shared.timed]") requirements
list the requirements imposed by these library types
in order to acquire or release ownership of a lock by a given execution agent[.](#3.sentence-2)

[*Note [3](#note-3)*:

The nature of any lock ownership and any synchronization it entails are not part
of these requirements[.](#3.sentence-3)

â *end note*]

[4](#4)

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

A lock on an object m is said to be

- [(4.1)](#4.1)

a [*non-shared lock*](#def:lock,non-shared "32.2.5.1 General [thread.req.lockable.general]") if it is acquired by a call tolock,try_lock,try_lock_for, ortry_lock_until on m, or

- [(4.2)](#4.2)

a [*shared lock*](#def:lock,shared "32.2.5.1 General [thread.req.lockable.general]") if it is acquired by a call tolock_shared,try_lock_shared,try_lock_shared_for, ortry_lock_shared_until on m[.](#4.sentence-1)

[*Note [4](#note-4)*:

Only the method of lock acquisition is considered;
the nature of any lock ownership is not part of these definitions[.](#4.sentence-2)

â *end note*]
