O'Reilly logo

The C++ Programming Language, Fourth Edition by Bjarne Stroustrup

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

42. Threads and Tasks

Keep Calm and Carry On.

– English slogan

Introduction

Threads

Identity; Construction; Destruction; join(); detach(); Namespace this_thread; Killing a thread; thread_local Data

Avoiding Data Races

Mutexes; Multiple Locks; call_once(); Condition Variables

Task-Based Concurrency

future and promise; promise; packaged_task; future; shared_future; async(); A Parallel find() Example

Advice

42.1. Introduction

Concurrency – the execution of several tasks simultaneously – is widely used to improve throughput (by using several processors for a single computation) or to improve responsiveness (by allowing one part of a program to progress while another is waiting for a response).

The C++ standard support for concurrency ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required