From 6701e03262d5db4b6071256653894828172d9809 Mon Sep 17 00:00:00 2001 From: omergzc Date: Fri, 5 Jun 2026 18:15:29 +0300 Subject: [PATCH] Create threaded_omer_gezici.py --- Week07/threaded_omer_gezici.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Week07/threaded_omer_gezici.py diff --git a/Week07/threaded_omer_gezici.py b/Week07/threaded_omer_gezici.py new file mode 100644 index 00000000..3fd420d1 --- /dev/null +++ b/Week07/threaded_omer_gezici.py @@ -0,0 +1,23 @@ +import threading +from functools import wraps +import random +import time + +def threaded(n: int): + def decorator(func): + @wraps(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 t in threads: + t.join() + + return None + return wrapper + return decorator