wip
This commit is contained in:
parent
3d19f91ee8
commit
c9da9ce60e
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="APPLICATION" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
import threading
|
||||
|
||||
def escribeY():
|
||||
for i in range(1000):
|
||||
print ("y", end="",flush=True)
|
||||
return
|
||||
|
||||
print ("INICIO")
|
||||
t = threading.Thread(target=escribeY)
|
||||
t.start()
|
||||
|
||||
for i in range(1000):
|
||||
print ("X", end="",flush=True)
|
|
@ -0,0 +1,17 @@
|
|||
import threading
|
||||
import time
|
||||
import random
|
||||
|
||||
def tareaUno():
|
||||
global Realizado
|
||||
#time.sleep (random.random())
|
||||
if not Realizado:
|
||||
print("Tarea realizada")
|
||||
Realizado = True
|
||||
return
|
||||
|
||||
Realizado = False
|
||||
t = threading.Thread(target=tareaUno)
|
||||
t.start()
|
||||
tareaUno()
|
||||
time.sleep(1)
|
|
@ -0,0 +1,23 @@
|
|||
import threading
|
||||
import time
|
||||
import random
|
||||
|
||||
def tareaUno():
|
||||
global Done
|
||||
time.sleep (random.random())
|
||||
if not Done:
|
||||
print("Tarea realizada")
|
||||
Done = True
|
||||
else :
|
||||
print ("tarea NO REALIZADA")
|
||||
return
|
||||
|
||||
Done = False
|
||||
hilos = list()
|
||||
for i in range(50):
|
||||
t = threading.Thread(target=tareaUno)
|
||||
hilos.append(t)
|
||||
t.start()
|
||||
|
||||
tareaUno()
|
||||
time.sleep(1)
|
|
@ -0,0 +1,15 @@
|
|||
import logging
|
||||
import threading
|
||||
import time
|
||||
|
||||
def thread_Apellido(name, inicio=1, fin=1):
|
||||
for x in range(inicio, fin):
|
||||
print (f"{name} Rodríguez {str(x)} años\n",end="")
|
||||
|
||||
|
||||
nombres = ["Julio", "Javier", "Eladio", "Jose", "Manuel"]
|
||||
hilos = list()
|
||||
for n in nombres:
|
||||
t = threading.Thread(target=thread_Apellido, args=(n,), kwargs={'inicio':5, 'fin':8})
|
||||
hilos.append(t)
|
||||
t.start()
|
Loading…
Reference in New Issue