diff --git a/Week07/threaded_eren_malkoc.py b/Week07/threaded_eren_malkoc.py new file mode 100644 index 00000000..d9267563 --- /dev/null +++ b/Week07/threaded_eren_malkoc.py @@ -0,0 +1,14 @@ +import threading + +def threaded(n): + def decorator(func): + def wrapper(*args, **kwargs): + threads = [] + for _ in range(n): + thread = threading.Thread(target=func, args=args, kwargs=kwargs) + threads.append(thread) + thread.start() + for thread in threads: + thread.join() + return wrapper + return decorator