From 9a4d3bc09e1741af4a60b1be430bf066528e80b3 Mon Sep 17 00:00:00 2001 From: fosanz Date: Fri, 24 Nov 2023 18:00:00 +0100 Subject: [PATCH] Minor bugfix --- lock.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lock.py b/lock.py index 4cfc7d1..688c142 100644 --- a/lock.py +++ b/lock.py @@ -16,6 +16,7 @@ class Cuenta: self.lock.acquire() if self.saldo < cantidad: print("No hay saldo suficiente") + self.lock.release() return False self.saldo -= cantidad self.printSaldo() @@ -28,5 +29,5 @@ class Cuenta: cuenta = Cuenta(1000) cuenta.printSaldo() -for i in range(10): - cuenta.extraer(100) \ No newline at end of file +for i in range(20): + threading.Thread(target=cuenta.extraer, args=(100,)).start() \ No newline at end of file