#include #include struct deux_int { int a; int b; }; void *print_hello(void *arg){ (void) arg; // ici on utilise pas l'argument printf("Hello\n"); pthread_exit(NULL); } void *print_nombre(void *arg){ struct deux_int ints = *(struct deux_int *) arg; // void* -> struct deux_int* -> struct deux_int printf("Les nombres sont :%d: et :%d:\n", ints.a, ints.b); pthread_exit(NULL); } int main(void){ pthread_t tid1, tid2; // thread 1 pthread_create(&tid1, NULL, print_hello, NULL); pthread_detach(tid1); //thread 2 struct deux_int ints; ints.a = 15; ints.b = 7; pthread_create(&tid2, NULL, print_nombre, (void *) &ints); // struct deux_int -> struct deux_int* -> void* pthread_detach(tid2); printf("Je peux terminer le thread principal sans avoir à attendre les deux autre en mode détaché\n"); pthread_exit(NULL); }