diff --git a/Pararelismo01.py b/ejemplos/Pararelismo01.py similarity index 100% rename from Pararelismo01.py rename to ejemplos/Pararelismo01.py diff --git a/creacionYEjecucion-02/Hilos01.py b/ejemplos/creacionYEjecucion-02/Hilos01.py similarity index 100% rename from creacionYEjecucion-02/Hilos01.py rename to ejemplos/creacionYEjecucion-02/Hilos01.py diff --git a/ejemplos/creacion_y_puesta_en_ejecucion/Ej01-thread.py b/ejemplos/creacion_y_puesta_en_ejecucion/Ej01-thread.py new file mode 100644 index 0000000..f4643c1 --- /dev/null +++ b/ejemplos/creacion_y_puesta_en_ejecucion/Ej01-thread.py @@ -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 \ No newline at end of file diff --git a/ejemplos/paralelism01/Ej02-threadç.py b/ejemplos/paralelism01/Ej02-threadç.py new file mode 100644 index 0000000..df063f9 --- /dev/null +++ b/ejemplos/paralelism01/Ej02-threadç.py @@ -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) \ No newline at end of file diff --git a/venv/tema01/test b/ejemplos/venv/tema01/test similarity index 100% rename from venv/tema01/test rename to ejemplos/venv/tema01/test diff --git a/pruebas/__init__.py b/pruebas/__init__.py new file mode 100644 index 0000000..920f2da --- /dev/null +++ b/pruebas/__init__.py @@ -0,0 +1,4 @@ +def my_function(*child): + print("The youngest child is " + child[1]) + +my_function("a","b") \ No newline at end of file