thread Class

Summary

Represents a thread of execution.

Syntax

class thread;

Header

#include "tbb/compat/thread"

Description

Class thread provides a platform independent interface to native threads. An instance represents a thread. A platform-specific thread handle can be obtained via method native_handle().

Members

namespace std {
    class thread {
    public:
#if _WIN32||_WIN64
        typedef HANDLE native_handle_type;
#else
        typedef pthread_t native_handle_type;
#endif // _WIN32||_WIN64

        class id;

        thread();
        template <typename F>
        explicit thread(F f);
        template <typename F, typename X>
        thread(F f, X x);
        template <typename F, typename X, typename Y>
        thread (F f, X x, Y y);
        thread(thread&& x); // Supported since C++11
        thread& operator=(thread&& x); // Supported since C++11
        thread& operator=(thread& x); // Supported only before C++11
        ~thread();

        void swap(thread& x);
        bool joinable() const;
        void join();
        void detach();
        id get_id() const;
        native_handle_type native_handle();

        static unsigned hardware_concurrency();
    } // thread
} // std
For more complete information about compiler optimizations, see our Optimization Notice.