Stats

1704 Contributors: 22 Thursday, July 13, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Threading

Syntax

  • thread()
  • thread(thread&& other)
  • explicit thread(Function&& func, Args&&... args)

Parameters

ParameterDetails
otherTakes ownership of other, other doesn't own the thread anymore
funcFunction to call in a seperate thread
argsArguments for func

Remarks

Some notes:

  • Two std::thread objects can never represent the same thread.
  • A std::thread object can be in a state where it doesn't represent any thread (i.e. after a move, after calling join, etc.).

Related Examples