C++ Threading

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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.).


Got any C++ Question?