convert from svn repository: remove tags directory
[lttv.git] / trunk / obsolete / usertrace-fast / test.c
1
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <stdlib.h>
6
7 #include <ltt/ltt-usertrace-fast.h>
8
9
10
11 void *thr1(void *arg)
12 {
13 int i;
14 ltt_thread_init();
15 printf("thread 1, thread id : %lu, pid %lu\n", pthread_self(), getpid());
16
17 //while(1) {}
18 for(i=0; i<5; i++) {
19 // ltt_usertrace_fast_buffer_switch();
20 sleep(1);
21 }
22
23 //return ((void*)1);
24 pthread_exit((void*)1);
25 }
26
27 void *thr2(void *arg)
28 {
29 int i;
30 ltt_thread_init();
31 //while(1) {
32 printf("thread 2, thread id : %lu, pid %lu\n", pthread_self(), getpid());
33 sleep(2);
34 //}
35 for(i=0; i<2; i++) {
36 // ltt_usertrace_fast_buffer_switch();
37 sleep(3);
38 }
39
40
41 return ((void*)2); /* testing "die" */
42 //pthread_exit((void*)2);
43 }
44
45
46 int main()
47 {
48 int i;
49 int err;
50 pthread_t tid1, tid2;
51 void *tret;
52
53 printf("thread main, thread id : %lu, pid %lu\n", pthread_self(), getpid());
54 err = pthread_create(&tid1, NULL, thr1, NULL);
55 if(err!=0) exit(1);
56
57 err = pthread_create(&tid2, NULL, thr2, NULL);
58 if(err!=0) exit(1);
59
60 for(i=0; i<2; i++) {
61 // ltt_usertrace_fast_buffer_switch();
62 sleep(3);
63 }
64
65 err = pthread_join(tid1, &tret);
66 if(err!= 0) exit(1);
67
68 err = pthread_join(tid2, &tret);
69 if(err!= 0) exit(1);
70
71 return 0;
72 }
This page took 0.02989 seconds and 4 git commands to generate.