---
name: "std::thread"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::thread"
---

# std::thread(3)

## NAME

std::thread

## SYNOPSIS

\#include \<thread\>

### Classes

class **id**\

### Public Types

using **native\_handle\_type**\

### Public Member Functions

template\<typename \_Callable, typename... \_Args, typename = \_Require\<\_\_not\_same\<\_Callable\>\>\> **thread** (\_Callable &&\_\_f, \_Args &&... \_\_args)\
 **thread** (const thread &)=delete\
 **thread** (thread &&\_\_t) noexcept\
 void **detach** ()\
 **id** **get\_id** () const noexcept\
 void **join** ()\
 bool **joinable** () const noexcept\
 native\_handle\_type **native\_handle** ()\
 thread & **operator=** (const thread &)=delete\
 thread & **operator=** (thread &&\_\_t) noexcept\
 void **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) noexcept\
 void **swap** (thread &\_\_x, thread &\_\_y) noexcept\

## 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\_type std::thread::native\_handle () \[inline\]

**Precondition**

thread is joinable

## Author

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