std::jthread:: hardware_concurrency
From cppreference.net
C++
Concurrency support library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::jthread
| Member functions | ||||
| Observers | ||||
|
jthread::hardware_concurrency
|
||||
| Operations | ||||
| Stop token handling | ||||
| Non-member functions | ||||
|
static
unsigned
int
hardware_concurrency
(
)
noexcept
;
|
(C++20부터) | |
구현에서 지원하는 동시 스레드 수를 반환합니다. 이 값은 단지 힌트로만 간주되어야 합니다.
목차 |
매개변수
(없음)
반환값
지원되는 동시 스레드 수. 값이 명확하게 정의되지 않거나 계산할 수 없는 경우 0 을 반환합니다.
예제
이 코드 실행
#include <iostream> #include <thread> int main() { unsigned int n = std::jthread::hardware_concurrency(); std::cout << n << " concurrent threads are supported.\n"; }
가능한 출력:
4 concurrent threads are supported.
참고 항목
|
거짓 공유(false sharing)를 방지하기 위한 최소 오프셋
진짜 공유(true sharing)를 촉진하기 위한 최대 오프셋 (상수) |