|
Wiki
Projet System - ENSEIRB-MATMECA 2012Sujetvoir ici Conceptiontypedef struct thread_elt thread_t struct thread_elt { struct ucontext context; struct thread_elt next; struct thread_let waiting_begin; void retval;}; var global: extern struct thread_elt ready_begin; //file des threads ready extern struct thread_elt cursor_ready; //pointe sur le thread courant thread_self() - renvoie cursor_ready thread_create(thread1) - créer et ajouter thread1 en tete de ready_begin - linker thread1 vers le contexte actuel - appeler thread_yield() thread_yield() - sauver le contexte actuel - choisir un thread dans ready_begin et executer son contexte thread_join(thread1, retval) - si thread1 est vivant: - retirer le thread actuel des ready_begin et le mettre dans waiting_deb du thread1 - sauvegarder contexte actuel |