What is the use of join in multithreading?
Use of join() in multithreading
Hey @mansi171299 ,
Once our multiple processes have completed there work , then we need to remove them or make them as a single process so that we can end it.
Hence , whenever we are using multiprocessing , the multiple tasks need to be joined into one process , so that we can end that particular task.
and to get this done, we use join command.
@prashant_ml
Did you mean that whenever we need to end all the processes, we first need to convert them into a single process?
I want to ask, Is it not possible to end these processes individually?
They can be ended , once they themselves get terminated.
But just imagine , a time when one thread is dependent on another , in that case this join function will work.
Means , if we call this function from a thread , then that thread after completion will wait for the other thread to merged with , until its execution gets completed,
In this way , we will be dealing with system errors also , and completing our task in proper manner.
I hope this helps a bit.