[thread.req.exception]

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

## 32.2 Requirements [[thread.req]](thread.req#exception)

### 32.2.2 Exceptions [thread.req.exception]

[1](#1)

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

Some functions described in this Clause are specified to throw exceptions of typesystem_error ([[syserr.syserr]](syserr.syserr "19.5.8 Class system_­error"))[.](#1.sentence-1)

Such exceptions are thrown if
any of the function's error conditions is detected or
a call to
an operating system or other underlying API results in an error that prevents the
library function from
meeting its specifications[.](#1.sentence-2)

Failure to allocate storage is reported as described
in [[res.on.exception.handling]](res.on.exception.handling "16.4.6.14 Restrictions on exception handling")[.](#1.sentence-3)

[*Example [1](#example-1)*:

Consider a function in this Clause that is specified to throw exceptions of typesystem_error and specifies error conditions that includeoperation_not_permitted for a thread that does not have the privilege to
perform the operation[.](#1.sentence-4)

Assume that, during the execution of this function, an errno of EPERM is reported by a POSIX API call used by the implementation[.](#1.sentence-5)

Since POSIX
specifies an errno of EPERM when âthe caller does not have the privilege
to perform the operationâ, the implementation maps EPERM to anerror_condition of operation_not_permitted ([[syserr]](syserr "19.5 System error support")) and an exception
of type system_error is thrown[.](#1.sentence-6)

â *end example*]

[2](#2)

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

The error_code reported by such an exception's code() member function
compares equal to one of the conditions specified in the function's error condition
element[.](#2.sentence-1)
