|
|
@ -16,6 +16,7 @@ class Cuenta:
|
|
|
|
self.lock.acquire()
|
|
|
|
self.lock.acquire()
|
|
|
|
if self.saldo < cantidad:
|
|
|
|
if self.saldo < cantidad:
|
|
|
|
print("No hay saldo suficiente")
|
|
|
|
print("No hay saldo suficiente")
|
|
|
|
|
|
|
|
self.lock.release()
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
self.saldo -= cantidad
|
|
|
|
self.saldo -= cantidad
|
|
|
|
self.printSaldo()
|
|
|
|
self.printSaldo()
|
|
|
@ -28,5 +29,5 @@ class Cuenta:
|
|
|
|
|
|
|
|
|
|
|
|
cuenta = Cuenta(1000)
|
|
|
|
cuenta = Cuenta(1000)
|
|
|
|
cuenta.printSaldo()
|
|
|
|
cuenta.printSaldo()
|
|
|
|
for i in range(10):
|
|
|
|
for i in range(20):
|
|
|
|
cuenta.extraer(100)
|
|
|
|
threading.Thread(target=cuenta.extraer, args=(100,)).start()
|