std::thread(3)
π NAME π
std::thread β that's the name, bestie. This page is chilling in the Library Functions Manual, section 3, and it's giving C++ concurrency royalty. π
β¨ SYNOPSIS β¨
#include <thread>
π Classes π
class id
π¦ Public Types π¦
using native_handle_type
β¨ Public Member Functions β¨
- the big constructor that starts a whole new thread:
template<typename _Callable, typename... _Args, typename =
_Require<__not_same<_Callable>>> thread (_Callable &&__f, _Args
&&... __args)
thread (const thread &)=deletethread (thread &&__t) noexceptvoid detach ()id get_id () const noexceptvoid join ()bool joinable () const noexceptnative_handle_type native_handle ()thread & operator= (const thread &)=deletethread & operator= (thread &&__t) noexceptvoid swap (thread &__t) noexcept
π Static Public Member Functions π
static unsigned int hardware_concurrency () noexcept
π Related Symbols π
(Note that these are not member symbols.)
bool operator== (thread::id __x, thread::id __y) noexceptvoid swap (thread &__x, thread &__y) noexcept
π« Detailed Description π«
A std::thread represents a new thread of execution. periodt.
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. β οΈ like, the WHOLE process, bestie β not a vibe, not a glitch, just termination.
Since: C++11
π₯ Member Function Documentation π₯
native_handle_type std::thread::native_handle () [inline]
Precondition: thread is joinable
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
mwah π this lil page came from libstdc++ and lives at std::thread(3). The footer has no date, so we're just gonna say it's giving libstdc++ + std::thread(3) and leave it iconic. π«Ά
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms