From 91632ffd468b1d2f869cdfdb160c51dee075f3d5 Mon Sep 17 00:00:00 2001 From: Burakhan7 <141933959+Burakhan7@users.noreply.github.com> Date: Thu, 4 Jun 2026 22:22:41 +0300 Subject: [PATCH 1/3] Create threaded_burakhan_gultoplar.py --- Week07/threaded_burakhan_gultoplar.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Week07/threaded_burakhan_gultoplar.py diff --git a/Week07/threaded_burakhan_gultoplar.py b/Week07/threaded_burakhan_gultoplar.py new file mode 100644 index 00000000..e8debfa4 --- /dev/null +++ b/Week07/threaded_burakhan_gultoplar.py @@ -0,0 +1,20 @@ +import threading +from functools import wraps + +def eszamanli_calistir(thread_sayisi: int): + def decorator(func): + @wraps(func) + def wrapper(*args, **kwargs): + is parçacıkları = [ + threading.Thread(target=func, args=args, kwargs=kwargs) + for _ in range(thread_sayisi) + ] + + for t in is_parçacıkları: + t.start() + + for t in is_parçacıkları: + t.join() + + return wrapper + return decorator From 34590e3b6960f94deae10acb5bb79c0291e6b624 Mon Sep 17 00:00:00 2001 From: Burakhan7 <141933959+Burakhan7@users.noreply.github.com> Date: Thu, 4 Jun 2026 22:24:28 +0300 Subject: [PATCH 2/3] Update threaded_burakhan_gultoplar.py --- Week07/threaded_burakhan_gultoplar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Week07/threaded_burakhan_gultoplar.py b/Week07/threaded_burakhan_gultoplar.py index e8debfa4..97db0b88 100644 --- a/Week07/threaded_burakhan_gultoplar.py +++ b/Week07/threaded_burakhan_gultoplar.py @@ -5,15 +5,15 @@ def eszamanli_calistir(thread_sayisi: int): def decorator(func): @wraps(func) def wrapper(*args, **kwargs): - is parçacıkları = [ + is parcaciklari = [ threading.Thread(target=func, args=args, kwargs=kwargs) for _ in range(thread_sayisi) ] - for t in is_parçacıkları: + for t in is_parcaciklari: t.start() - for t in is_parçacıkları: + for t in is_parcaciklari: t.join() return wrapper From 0d9cb7f7305af4b21dcbee4c3a5ee4782d139442 Mon Sep 17 00:00:00 2001 From: Burakhan7 <141933959+Burakhan7@users.noreply.github.com> Date: Thu, 4 Jun 2026 22:26:20 +0300 Subject: [PATCH 3/3] Update threaded_burakhan_gultoplar.py --- Week07/threaded_burakhan_gultoplar.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Week07/threaded_burakhan_gultoplar.py b/Week07/threaded_burakhan_gultoplar.py index 97db0b88..b9860f2c 100644 --- a/Week07/threaded_burakhan_gultoplar.py +++ b/Week07/threaded_burakhan_gultoplar.py @@ -1,20 +1,29 @@ import threading + from functools import wraps +def threaded(n: int): -def eszamanli_calistir(thread_sayisi: int): def decorator(func): + @wraps(func) + def wrapper(*args, **kwargs): - is parcaciklari = [ - threading.Thread(target=func, args=args, kwargs=kwargs) - for _ in range(thread_sayisi) - ] + + threads = [] + for _ in range(n): + + t = threading.Thread(target=func, args=args, kwargs=kwargs) + + threads.append(t) - for t in is_parcaciklari: - t.start() - - for t in is_parcaciklari: + for t in threads: + + t.start() + + for t in threads: + t.join() return wrapper + return decorator