X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_timing.c;h=4de8896b77d024abe2d11b43ba5b9414f1bbbef3;hb=550265b2c2de28e0fe566f71fb1cab64fa620efa;hp=8e1a8104f6ee649409537edbfc9cab7f97798d00;hpb=06f22bdbb0c4c4d5db42a2e2dc35818aa61415be;p=urcu.git diff --git a/tests/test_urcu_timing.c b/tests/test_urcu_timing.c index 8e1a810..4de8896 100644 --- a/tests/test_urcu_timing.c +++ b/tests/test_urcu_timing.c @@ -29,10 +29,13 @@ #include #include #include -#include #include #include +#ifdef __linux__ +#include +#endif + #if defined(_syscall0) _syscall0(pid_t, gettid) #elif defined(__NR_gettid) @@ -104,7 +107,8 @@ void *thr_reader(void *arg) cycles_t time1, time2; printf("thread_begin %s, thread id : %lx, tid %lu\n", - "reader", pthread_self(), (unsigned long)gettid()); + "reader", (unsigned long) pthread_self(), + (unsigned long) gettid()); sleep(2); rcu_register_thread(); @@ -128,7 +132,8 @@ void *thr_reader(void *arg) sleep(2); printf("thread_end %s, thread id : %lx, tid %lu\n", - "reader", pthread_self(), (unsigned long)gettid()); + "reader", (unsigned long) pthread_self(), + (unsigned long) gettid()); return ((void*)1); } @@ -140,7 +145,8 @@ void *thr_writer(void *arg) cycles_t time1, time2; printf("thread_begin %s, thread id : %lx, tid %lu\n", - "writer", pthread_self(), (unsigned long)gettid()); + "writer", (unsigned long) pthread_self(), + (unsigned long) gettid()); sleep(2); for (i = 0; i < OUTER_WRITE_LOOP; i++) { @@ -168,7 +174,8 @@ void *thr_writer(void *arg) } printf("thread_end %s, thread id : %lx, tid %lu\n", - "writer", pthread_self(), (unsigned long)gettid()); + "writer", (unsigned long) pthread_self(), + (unsigned long) gettid()); return ((void*)2); } @@ -194,7 +201,8 @@ int main(int argc, char **argv) tid_writer = malloc(sizeof(*tid_writer) * num_write); printf("thread %-6s, thread id : %lx, tid %lu\n", - "main", pthread_self(), (unsigned long)gettid()); + "main", (unsigned long) pthread_self(), + (unsigned long) gettid()); for (i = 0; i < NR_READ; i++) { err = pthread_create(&tid_reader[i], NULL, thr_reader,