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