home | help
std::thread..._concurrency(3)  C++ Standard Libary std::thread..._concurrency(3)

NAME
     std::thread::hardware_concurrency - std::thread::hardware_concurrency

Synopsis
	static unsigned int hardware_concurrency() noexcept;  (since C++11)

	Returns  the  number  of concurrent threads supported by the implementa-
     tion. The value
	should be considered only a hint.

Parameters
	(none)

Return value
	Number of concurrent threads supported. If the value is not well defined
     or not
	computable, returns 0.

Example
     // Run this code

      #include <iostream>
      #include <thread>

      int main()
      {
	  unsigned int n = std::thread::hardware_concurrency();
	  std::cout << n << " concurrent threads are supported.\n";
      }

Possible output:
      4 concurrent threads are supported.

See also
	hardware_destructive_interference_size	min offset to avoid false  shar-
     ing
	hardware_constructive_interference_size max offset to promote true shar-
     ing
	(C++17) 				(constant)

http://cppreference.com 	   2024.06.10	   std::thread..._concurrency(3)

home | help