#Fichier thread_2.py
import _thread
import time

print("début du programme")

def processus_1():
    i=0
    while i <3:
        print(str(_thread.get_ident()) + " : " + "11111111")
        time.sleep(0.5)
        i += 1
    global nb_thread_fini
    nb_thread_fini += 1

def processus_2():
    i=0
    while i <3:
        print(str(_thread.get_ident()) + " : " + "22222222")
        time.sleep(0.5)
        i += 1
    global nb_thread_fini
    nb_thread_fini += 1

#Nombre de thread prévu
global nb_thread
nb_thread = 2
#Nombre de thread après réalisation
global nb_thread_fini
nb_thread_fini = 0

#Création de deux instances thread
_thread.start_new_thread(processus_1, ())
_thread.start_new_thread(processus_2, ())

#Boucle d'attente de fin d'exécution des thread
while nb_thread_fini < nb_thread:
    pass
print("Fin du programme")



