Home »
Python »
Python programs
Python program to illustrate naming of threads
Here, we are going to learn about the naming of threads with example.
Submitted by Shivang Yadav, on February 19, 2021
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,
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
...
...
Python Threading Programs »