Starting Threads
Understand how threads are started in this lesson.
We'll cover the following
spawn()
spawn()
takes a function pointer as a parameter and starts a new thread from that function. Any operations that are carried out by that function, including other functions that it may call, would be executed on the new thread.
The main difference between a thread that is started with
spawn()
and a thread that is started withtask()
is the fact thatspawn()
makes it possible for threads to send messages to each other.
As soon as a new thread is started, the owner and the worker start executing separately as if they were independent programs:
Get hands-on with 1400+ tech skills courses.