C++ Thread Library - Function swap



Description

It is used to exchanges the state of the thread objects x and y.

Declaration

Following is the declaration for std::thread::swap function.

void swap (thread& x, thread& y) noexcept;

C++11

void swap (thread& x, thread& y) noexcept;

Parameters

x,y − It is a thread objects.

Return Value

none

Exceptions

No-throw guarantee − never throws exceptions.

Data races

Objects, x and y, are modified.

thread.htm
Advertisements