mirror of https://github.com/JavMB/ejercicios
Refactor threading example in 01.py
This commit is contained in:
parent
c49849ea22
commit
bfb9b6b773
|
|
@ -1,17 +1,15 @@
|
||||||
# importamos threading
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
def hilo3():
|
|
||||||
print("Soy hilo 3 y último")
|
|
||||||
|
|
||||||
def hilo2():
|
def Hilo2():
|
||||||
print("Soy el hilo 2")
|
print ('Soy el hilo 2\n')
|
||||||
t3 = threading.Thread(target=hilo3)
|
t3 = threading.Thread(target=Hilo3)
|
||||||
t3.start()
|
t3.start()
|
||||||
t3.join()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def Hilo3():
|
||||||
print("Soy el Hilo 1 y primero")
|
print ('Soy el hilo 3 y último\n')
|
||||||
t2 = threading.Thread(target=hilo2)
|
|
||||||
t2.start()
|
t2 = threading.Thread(target=Hilo2)
|
||||||
t2.join()
|
|
||||||
|
t2.start()
|
||||||
|
print ("Soy el Hilo 1 y primero\n")
|
||||||
Loading…
Reference in New Issue