Moving Threads

This lesson gives an overview of problems and challenges related to moving threads in C++.

Moving threads make the lifetime issues of threads even harder.

A thread supports the move semantic but not the copy semantic, the reason being the copy constructor of std::thread is set to delete: thread(const thread&) = delete;. Imagine what will happen if you copy a thread while the thread is holding a lock.

Let’s move a thread.

Get hands-on with 1200+ tech skills courses.