Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threads join() question
#1
Hi guys,

so I'm pretty new to threading, I have a question in regards to the join function let me put some example code below

import threading

def funcOne():
     print(threading.current_thread().getName())

def funcTwo():
    print(threading.current_thread().getName())


t1 = threading.Thread(target = funcOne, name = "T one")
t2 = threading.Thread(target = funcTwo, name = "T two")

t1.start()
t2.start()

t1.join()
t2.join()

print("bye")
so my question is, I start both threads with t1.start() and t2.start(), so what does the join function do here? from what I have took in, the join() function will make sure that thread finishes before running anymore threads/ functions, BUT as you can see I call t1.join() so now does main stop functioning until t1 finishes? if so is t2 still running?? does the t2.join() function get called after the thread t1 finishes?

thanks
Reply


Messages In This Thread
Threads join() question - by adam2020 - Mar-19-2019, 07:32 PM
RE: Threads join() question - by nilamo - Mar-19-2019, 07:59 PM
RE: Threads join() question - by adam2020 - Mar-19-2019, 08:23 PM
RE: Threads join() question - by nilamo - Mar-19-2019, 08:52 PM
RE: Threads join() question - by adam2020 - Mar-19-2019, 09:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The difference between os.path.join( and os.sep.join( Pedroski55 2 9,491 Nov-17-2020, 08:38 AM
Last Post: Pedroski55
  Question on Join() function sduvvuri 2 2,767 Jun-02-2019, 03:55 PM
Last Post: perfringo
  SQL select join operation in python(Select.. join) pradeepkumarbe 1 2,253 Feb-14-2019, 08:34 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020