Python Multithreading--Part2 (Overriding run Method of Thread class)

 # -*- coding: utf-8 -*-

"""

Created on Fri Sep 30 14:01:03 2022


@author: Mahesh.Keshniya


Python Multithreading--Part2


Every thread Call "Run" method of "Thread" class through start() method but In this example we override Run method of

Thread(BASE class) by Child class Run Method....


Hence If create thread and call start function than start function call Run of child class




"""

from threading import Thread, current_thread


class Myclass(Thread):


    def run(self):

        print("I am run method of child thread", current_thread().name)


if __name__=="__main__" :

    print("I am Main thread name:",current_thread().name)


    t=Myclass()


    t.start()

    t.join()







Comments