0

Currently going through an educative course and there was output of a code snippet posted

def thread_task():
    print("{0} executing".format(current_thread().getName()))


myThread = Thread(group=None,  # reserved
                  target=thread_task(),
                  name="childThread")

myThread.start()
myThread.join()

The output of this thread according to the answers is MainThread executing. My question is why wouldn't the output be "childThread Executing"? Doesn't the statement myThread.join() during the main thread mean its going to wait for the child thread to finish the thread_task()? And didn't the code explicitly set the name for that thread to be childThread?

0 Answers0