Moving Threads
This lesson gives an overview of problems and challenges related to moving threads in C++.
We'll cover the following...
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.
Access this course and 1400+ top-rated courses and projects.