wip
This commit is contained in:
parent
bae6b7b92e
commit
c5f95d72aa
|
@ -0,0 +1,16 @@
|
||||||
|
import threading
|
||||||
|
|
||||||
|
# mét-odo al que se va a aosciar el hilo
|
||||||
|
def SaludoHilo2():
|
||||||
|
print ('soy el hilo 2\n')
|
||||||
|
t3.start()
|
||||||
|
|
||||||
|
def SaludoHilo3():
|
||||||
|
print ('hola, soy el hilo 3\n')
|
||||||
|
|
||||||
|
# creamos un hilo asociado a una función
|
||||||
|
t3 = threading.Thread(target=SaludoHilo3)
|
||||||
|
t2 = threading.Thread(target=SaludoHilo2)
|
||||||
|
#
|
||||||
|
t2.start()
|
||||||
|
print ("hola, soy el hilo 1 y primero \n") #impresión en el hilo principal
|
|
@ -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,4 @@
|
||||||
|
def my_function(*child):
|
||||||
|
print("The youngest child is " + child[1])
|
||||||
|
|
||||||
|
my_function("a","b")
|
Loading…
Reference in New Issue