Initial commit

master
Victor 1 year ago
commit 3716bf8dd2

@ -0,0 +1,25 @@
from threading import Lock, Thread
import threading
import time
def retirarDinero(retirar,lock):
with lock:
global dineroTotal
if dineroTotal == 0:
print("Saldo insuficiente")
else:
print("Dinero retirado")
dineroTotal = dineroTotal-retirar
lock = threading.Lock()
dineroTotal = 1000
retDinero = 200
for i in range(3):
t = threading.Thread(retirarDinero(retDinero,lock))
t2 = threading.Thread(retirarDinero(retDinero,lock))
t.join
t2.join
Loading…
Cancel
Save

Powered by INFORMATICA.FP.EDU.ES.