d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Multithreading In Java - Join Method
Add Reply New Topic New Poll
Member
Posts: 31,293
Joined: Mar 25 2009
Gold: 0.00
Jun 8 2020 06:47pm
When using join method with multithreading

Say you're running main method + thread1 (inside main method)

thread1.join()... will this make it so main method will not execute any code after join method till thread1 finishes, or that main thread will not terminate till thread 1 terminates... hopefully this makes sense.

This post was edited by ferf on Jun 8 2020 06:49pm
Member
Posts: 12,703
Joined: May 17 2013
Gold: 12,935.00
Jun 9 2020 10:39am
calling .join() on a thread means you are waiting for that thread to finish execution (and therefore the termination of the thread)

waiting implies no code will run until the thread has terminated
Member
Posts: 31,293
Joined: Mar 25 2009
Gold: 0.00
Jun 9 2020 12:33pm
Quote (Klexmoo @ Jun 9 2020 11:39am)
calling .join() on a thread means you are waiting for that thread to finish execution (and therefore the termination of the thread)

waiting implies no code will run until the thread has terminated


awesome ty :)
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll