thread
takes a function as its first argumentjoin
to wait until the thread is done- Threads share an address space, which also allows communicating between them
- The remaining
thread
arguments are passed to the function - Alternative: Store them in a function object
- Use pointers and references
mutex
andunique_lock
as discussed before
<condition_variable>
to notify other threads that a value is now available
promise
to pass values,future
to accept them- value or exception is passed to
promise
future
waits for thempackaged_task
createspromise
andfuture
async
to run a function in a different thread, without knowing how many threads are created. It essentially works on a higher abstraction level. A call toasync
returns apromise