This commit is contained in:
jon ander 2024-10-29 18:49:19 +01:00
parent bae6b7b92e
commit c5f95d72aa
6 changed files with 33 additions and 0 deletions

View File

@ -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

View File

@ -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)

4
pruebas/__init__.py Normal file
View File

@ -0,0 +1,4 @@
def my_function(*child):
print("The youngest child is " + child[1])
my_function("a","b")