tls
[lttv.git] / usertrace / test.c
1
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <stdlib.h>
6
7 #include "lttng_usertrace.h"
8
9
10
11 void *thr1(void *arg)
12 {
13 printf("thread 1, thread id : %lu, pid %lu\n", pthread_self(), getpid());
14
15 while(1) {}
16
17 return ((void*)1);
18
19 }
20
21 void *thr2(void *arg)
22 {
23 while(1) {
24 printf("thread 2, thread id : %lu, pid %lu\n", pthread_self(), getpid());
25 sleep(2);
26 }
27 return ((void*)2);
28 }
29
30
31 int main()
32 {
33 int err;
34 pthread_t tid1, tid2;
35 void *tret;
36
37 err = pthread_create(&tid1, NULL, thr1, NULL);
38 if(err!=0) exit(1);
39
40 err = pthread_create(&tid2, NULL, thr2, NULL);
41 if(err!=0) exit(1);
42
43 while(1)
44 {
45
46 }
47
48 err = pthread_join(tid1, &tret);
49 if(err!= 0) exit(1);
50
51 err = pthread_join(tid2, &tret);
52 if(err!= 0) exit(1);
53
54 return 0;
55 }
This page took 0.0354 seconds and 5 git commands to generate.