Search:
Reference
<mutex>
unique_lock
swap
function
<mutex>
std::
swap (unique_lock)
template <class Mutex> void swap (unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
Swap locks
Exchanges the state of the
unique_lock
objects
x
and
y
.
This is an overload of
swap
that behaves as if
x.
swap
(y)
was called.
Parameters
x,y
unique_lock
objects to swap.
Return value
none
Data races
Both objects,
x
and
y
, are modified.
Neither managed
mutex object
is accessed by the operation.
Exception safety
No-throw guarantee:
never throws exceptions.
See also
unique_lock::swap
Swap unique locks
(public member function )
unique_lock::operator=
Move-assign unique_lock
(public member function )
swap
Exchange values of two objects
(function template )
C++
Information
Tutorials
Reference
Articles
Forum
Reference
C library:
<cassert> (assert.h)
<cctype> (ctype.h)
<cerrno> (errno.h)
<cfenv> (fenv.h)
<cfloat> (float.h)
<cinttypes> (inttypes.h)
<ciso646> (iso646.h)
<climits> (limits.h)
<clocale> (locale.h)
<cmath> (math.h)
<csetjmp> (setjmp.h)
<csignal> (signal.h)
<cstdarg> (stdarg.h)
<cstdbool> (stdbool.h)
<cstddef> (stddef.h)
<cstdint> (stdint.h)
<cstdio> (stdio.h)
<cstdlib> (stdlib.h)
<cstring> (string.h)
<ctgmath> (tgmath.h)
<ctime> (time.h)
<cuchar> (uchar.h)
<cwchar> (wchar.h)
<cwctype> (wctype.h)
Containers:
<array>
<deque>
<forward_list>
<list>
<map>
<queue>
<set>
<stack>
<unordered_map>
<unordered_set>
<vector>
Input/Output:
<fstream>
<iomanip>
<ios>
<iosfwd>
<iostream>
<istream>
<ostream>
<sstream>
<streambuf>
Multi-threading:
<atomic>
<condition_variable>
<future>
<mutex>
<thread>
Other:
<algorithm>
<bitset>
<chrono>
<codecvt>
<complex>
<exception>
<functional>
<initializer_list>
<iterator>
<limits>
<locale>
<memory>
<new>
<numeric>
<random>
<ratio>
<regex>
<stdexcept>
<string>
<system_error>
<tuple>
<type_traits>
<typeindex>
<typeinfo>
<utility>
<valarray>
<mutex>
classes:
adopt_lock_t
defer_lock_t
lock_guard
mutex
once_flag
recursive_mutex
recursive_timed_mutex
timed_mutex
try_to_lock_t
unique_lock
functions:
call_once
lock
try_lock
constants:
adopt_lock
defer_lock
try_to_lock
unique_lock
unique_lock::~unique_lock
unique_lock::unique_lock
member functions:
unique_lock::lock
unique_lock::mutex
unique_lock::operator bool
unique_lock::operator=
unique_lock::owns_lock
unique_lock::release
unique_lock::swap
unique_lock::try_lock
unique_lock::try_lock_for
unique_lock::try_lock_until
unique_lock::unlock
non-member overloads:
swap (unique_lock)