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