logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Author

       Generated automatically by Doxygen for libstdc++ from the source code.

                                                    libstdc++                                  std::thread(3cxx)

Detailed Description

       A std::thread represents a new thread of execution.

       The default constructor creates an object that does not own a thread. The thread(F&&, Args&&...)
       constructor invokes a callable in a new thread, and owns that new thread. A std::thread that owns a
       thread is joinable. Joining a thread waits for it to finish executing, which happens when the callable
       running in that thread returns.

       A std::thread cannot be copied, but can be moved. Moving a joinable object transfers ownership of its
       thread to another object.

       A joinable std::thread must be explicitly joined (or detached) before it is destroyed or assigned to.
       Attempting to destroy a joinable thread will terminate the whole process.

       Since
           C++11

Member Function Documentation

native_handle_typestd::thread::native_handle()[inline]Precondition
           thread is joinable

Name

       std::thread

Synopsis

       #include <thread>

   Classes
       class idPublicTypesusingnative_handle_type = __gthread_t

   PublicMemberFunctions
       template<typename _Callable , typename... _Args, typename  = _Require<__not_same<_Callable>>> thread
           (_Callable &&__f, _Args &&... __args)
       thread (const thread &)=deletethread (thread &&__t) noexcept
       voiddetach ()
       idget_id () const noexcept
       voidjoin ()
       bool joinable () const noexcept
       native_handle_type native_handle ()
       thread & operator= (const thread &)=deletethread & operator= (thread &&__t) noexcept
       voidswap (thread &__t) noexcept

   StaticPublicMemberFunctionsstatic unsigned int hardware_concurrency () noexcept

   RelatedSymbols
       (Note that these are not member symbols.)
       voidswap (thread &__x, thread &__y) noexcept

See Also