Q:

Python program to illustrate naming of threads

belongs to collection: Python Threading Programs

0

Threads are small units that can be processed by OS, and are sub parts of a process.

Python uses the threading library to support multithreading and some more functions. The method allows the user to give names to their threads which can be accessed later on using, 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Python program to illustrate naming of threads

import threading

def ProcessOne():
    while(True):
        print(threading.current_thread().getName(),"is Running")

def ProcessTwo():
    while(True):
        print(threading.current_thread().getName(),"is Running")


T1=threading.Thread(target=ProcessOne,name="Swift")
T2=threading.Thread(target=ProcessTwo,name='Alto')

T1.start()
T2.start()

Output:

Swift is Running
Alto is Running 
...
...

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python Program to illustrate parameterized threads... >>