Skip to content

Commit 1469c39

Browse files
authored
Merge pull request #857 from erenmalkoc/patch-10
Create threaded_eren_malkoc.py
2 parents 8e51040 + a2aceef commit 1469c39

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Week07/threaded_eren_malkoc.py

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

0 commit comments

Comments
 (0)