Archivo de Python:
Ejecución del programa:
Código:
import time
import thread
def imprimir_mensaje(mensaje):
while True:
print(mensaje)
time.sleep(1)
def main():
mensaje="Thread1"
mensaje2="Thread2"
#empiezo el thread
thread.start_new_thread(imprimir_mensaje,(mensaje,))
thread.start_new(imprimir_mensaje,(mensaje2,))
x = raw_input("Estoy esperando que presiones enter...\n")
print("Termino la funcion main")
main()
No hay comentarios:
Publicar un comentario