Skip to content

Commit aeb2807

Browse files
authored
Merge pull request #809 from beyzasaridas/patch-12
Create threaded_beyza_saridas.py
2 parents ab6e89f + 0bcb824 commit aeb2807

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Week07/threaded_beyza_saridas.py

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

0 commit comments

Comments
 (0)