Commit 5b7887fc06ac0f9ec8318671cf2019cd1adacfc6
1 parent
fed98e68
Début thread
Showing
2 changed files
with
21 additions
and
0 deletions
Show diff stats
No preview for this file type
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +#include <stdio.h> | ||
2 | +#include <stdlib.h> | ||
3 | +#include <pthread.h> | ||
4 | + | ||
5 | + | ||
6 | +int lanceThread(void(* fonction) (void *), void* arg, int size) | ||
7 | +{ | ||
8 | + pthread_t thr_id; | ||
9 | + | ||
10 | + if(pthread_create(&thr_id, NULL, fonction, arg)!=0) { fprintf(stderr, "Le thread n'a pas pu être créé.\n"); return -1; } | ||
11 | + | ||
12 | + pthread_detach(thr_id); | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | +} | ||
17 | + | ||
18 | +int main(void) | ||
19 | +{ | ||
20 | + | ||
21 | +} |