Skip to content

Commit 6a87def

Browse files
authored
Merge pull request #795 from rukiye-ilhan/patch-14
Create threaded_rukiye_ilhan.py
2 parents bf0ef4e + d6c3264 commit 6a87def

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Week07/threaded_rukiye_ilhan.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import threading
2+
3+
def threaded(n):
4+
def decorator(func):
5+
def wrapper(*args, **kwargs):
6+
threads = []
7+
for i in range(n):
8+
t = threading.Thread(target=func, args=args, kwargs=kwargs)
9+
threads.append(t)
10+
t.start()
11+
for thread in threads:
12+
thread.join()
13+
return wrapper
14+
return decorator
15+

0 commit comments

Comments
 (0)