mirror of
https://github.com/Relintai/programming_tutorials.git
synced 2025-05-11 22:52:11 +02:00
20 lines
382 B
Python
20 lines
382 B
Python
import threading
|
|
import time
|
|
|
|
class MyThread(threading.Thread):
|
|
def __init__(self, threadID, name):
|
|
threading.Thread.__init__(self)
|
|
self.threadID = threadID
|
|
self.name = name
|
|
|
|
def run(self):
|
|
print("t: " + self.name + " " + str(self.threadID))
|
|
|
|
th1 = MyThread(1, "t1")
|
|
th2 = MyThread(2, "t2")
|
|
|
|
th1.start();
|
|
th2.start();
|
|
|
|
th1.join();
|
|
th2.join(); |