Skip to content

Commit 0f9eb65

Browse files
authored
Merge pull request #1333 from ArdaDenizKinikli/patch-7
Create: threaded_ardadeniz_kinikli.py
2 parents 0bc3a10 + 41f7c98 commit 0f9eb65

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)