add python threading examples and intros for lec 18 spoc discuss
This commit is contained in:
13
related_info/lab7/semaphore_condition/thr-ex4.py
Normal file
13
related_info/lab7/semaphore_condition/thr-ex4.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import threading
|
||||
|
||||
class MyThread(threading.Thread):
|
||||
def __init__(self):
|
||||
threading.Thread.__init__(self)
|
||||
|
||||
def run(self):
|
||||
print "I am %s" % (self.name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
for i in range(0, 5):
|
||||
my_thread = MyThread()
|
||||
my_thread.start()
|
||||
Reference in New Issue
Block a user