Documentation Home >> Headers >> <thread> Header >> std::thread class

The std::thread class is used to manage a thread of execution. It provides a means of starting a new thread of execution and waiting for the completion of a thread of execution. It also provides a means for identifying, and other functions for managing threads of execution.

For details on the members, see std::thread class members.

class thread
{
public:
    // Types
    class id;
    typedef implementation-defined
        native_handle_type;

    // Construction and Destruction
    thread();

    ~thread();

    template<typename Callable>
    explicit thread(Callable func);

    template<typename Callable,typename Args...>
    thread(Callable func,Args... args);

    // Copying and Moving
    thread(thread const& other) = delete;
    thread(thread&& other);

    thread& operator=(thread const& other) = delete;
    thread& operator=(thread&& other);

    void swap(thread& other);

    void join();
    void detach();
    bool joinable() const;

    id get_id() const;

    native_handle_type native_handle();

    static unsigned hardware_concurrency();
};

void swap(thread& lhs,thread& rhs);
Header

#include <thread>

See Also