From f6ffc5f48f2367f90dfb1b2ba9a378740330a5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Balc=C4=B1?= <148548201+MehmetxBalci@users.noreply.github.com> Date: Fri, 5 Jun 2026 13:24:05 +0300 Subject: [PATCH] Add threaded decorator for concurrent execution --- Week07/threaded_mehmet_balci.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week07/threaded_mehmet_balci.py diff --git a/Week07/threaded_mehmet_balci.py b/Week07/threaded_mehmet_balci.py new file mode 100644 index 00000000..d9ed4c2b --- /dev/null +++ b/Week07/threaded_mehmet_balci.py @@ -0,0 +1,10 @@ +from concurrent.futures import ThreadPoolExecutor + +def threaded(n): + def decorator(func): + def wrapper(*args, **kwargs): + with ThreadPoolExecutor(max_workers=n) as executor: + for _ in range(n): + executor.submit(func, *args, **kwargs) + return wrapper + return decorator