Skip to content

Create threaded_beyza_saridas.py #804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Week07/threaded_beyza_saridas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import threading

def threaded(n):
def decorator(func):
def wrapper(*args, **kwargs):
threads = []
for i in range(n):
t = threading.Thread(target=func, args=args, kwargs=kwargs)
threads.append(t)
t.start()
for thread in threads:
thread.join()
return wrapper
return decorator
Loading