[thread.req.lockable.timed]

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

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

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

#### 32.2.5.4 *Cpp17TimedLockable* requirements [thread.req.lockable.timed]

[1](#1)

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

A type L meets the *Cpp17TimedLockable* requirements if it meets the [*Cpp17Lockable*](thread.req.lockable.req#:Cpp17Lockable "32.2.5.3 Cpp17Lockable requirements [thread.req.lockable.req]") requirements and the following expressions are well-formed and have the specified semantics
(m denotes a value of type L, rel_time denotes a value of an
instantiation of [duration](time.duration "30.5 Class template duration [time.duration]"), and abs_time denotes a value
of an instantiation of [time_point](time.point "30.6 Class template time_­point [time.point]"))[.](#1.sentence-1)

[ð](#itemdecl:1)

`m.try_lock_for(rel_time)
`

[2](#2)

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

*Effects*: Attempts to acquire a lock for the current execution agent within the relative
timeout ([[thread.req.timing]](thread.req.timing "32.2.4 Timing specifications")) specified by rel_time[.](#2.sentence-1)

The function will not return
within the timeout specified by rel_time unless it has obtained a lock on m for the current execution agent[.](#2.sentence-2)

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

[3](#3)

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

*Return type*: bool[.](#3.sentence-1)

[4](#4)

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

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

[ð](#itemdecl:2)

`m.try_lock_until(abs_time)
`

[5](#5)

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

*Effects*: Attempts to acquire a lock for the current execution agent before the absolute
timeout ([[thread.req.timing]](thread.req.timing "32.2.4 Timing specifications")) specified by abs_time[.](#5.sentence-1)

The function will not return
before the timeout specified by abs_time unless it has obtained a lock on m for
the current execution agent[.](#5.sentence-2)

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

[6](#6)

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

*Return type*: bool[.](#6.sentence-1)

[7](#7)

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

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