- Hello again, and welcome to lesson 14.
This lesson is all about multithreading and concurrency.
We begin by showing how to spawn a thread.
In other words, how to create it.
Then we'll see how to join the thread or multiple threads,
in other words, to wait for 'em to finish.
After that, we'll see how a thread
can capture a state for its external context.
We've discussed the concepts and the syntax,
and we'll see why it's essential
that the thread always captures external state
by moving it into the thread,
rather than just borrowing it via a reference.
At the end of the lesson,
we'll discuss the concept of channels.
A channel is a communication pipeline
that conveys data safely from one thread to another.
This is the preferred way to communicate
between threads in Rust.