Commit | Line | Data |
---|---|---|
dfdf4860 JB |
1 | #include <unistd.h> // pour sleep |
2 | #include <pthread.h> // pthread_create, pthread_join, pthread_exit | |
3 | #include <stdio.h> | |
4 | ||
5 | static void* fonction(void* args) { | |
6 | printf("pid du thread fils = %d\n", getpid()); | |
6773299b | 7 | while (1); // forever |
dfdf4860 JB |
8 | return NULL; |
9 | } | |
10 | ||
11 | int main() { | |
12 | pthread_t thread; | |
13 | ||
14 | printf("pid de main = %d\n", getpid()); | |
15 | pthread_create(&thread, NULL, &fonction, NULL); | |
6773299b | 16 | while (1); // forever |
dfdf4860 JB |
17 | return 0; |
18 | } |