-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurrent_parallelism.py
More file actions
40 lines (36 loc) · 1.03 KB
/
Copy pathcurrent_parallelism.py
File metadata and controls
40 lines (36 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import threading
import time
def first_function():
print (threading.currentThread().getName()+\
str(' is Starting \n'))
time.sleep(2)
print (threading.currentThread().getName()+\
str( ' is Exiting \n'))
return
def second_function():
print (threading.currentThread().getName()+\
str(' is Starting \n'))
time.sleep(2)
print (threading.currentThread().getName()+\
str( ' is Exiting \n'))
return
def third_function():
print (threading.currentThread().getName()+\
str(' is Starting \n'))
time.sleep(2)
print (threading.currentThread().getName()+\
str( ' is Exiting \n'))
return
if __name__ == "__main__":
t1 = threading.Thread\
(name='first_function', target=first_function)
t2 = threading.Thread\
(name='second_function', target=second_function)
t3 = threading.Thread\
(name='third_function',target=third_function)
t1.start()
t2.start()
t3.start()
t1.join()
t2.join()
t3.join()