Rizin
unix-like reverse engineering framework and cli tools
main.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <unistd.h>
3
4
#include <
uv.h
>
5
6
void
hare
(
void
*
arg
) {
7
int
tracklen = *((
int
*)
arg
);
8
while
(tracklen) {
9
tracklen--;
10
sleep(1);
11
fprintf(stderr,
"Hare ran another step\n"
);
12
}
13
fprintf(stderr,
"Hare done running!\n"
);
14
}
15
16
void
tortoise
(
void
*
arg
) {
17
int
tracklen = *((
int
*)
arg
);
18
while
(tracklen) {
19
tracklen--;
20
fprintf(stderr,
"Tortoise ran another step\n"
);
21
sleep(3);
22
}
23
fprintf(stderr,
"Tortoise done running!\n"
);
24
}
25
26
int
main
() {
27
int
tracklen = 10;
28
uv_thread_t
hare_id;
29
uv_thread_t
tortoise_id;
30
uv_thread_create
(&hare_id,
hare
, &tracklen);
31
uv_thread_create
(&tortoise_id,
tortoise
, &tracklen);
32
33
uv_thread_join
(&hare_id);
34
uv_thread_join
(&tortoise_id);
35
return
0;
36
}
main
int main(int argc, const char **argv)
Definition:
main.c:340
arg
Definition:
sparc-opc.c:1836
tortoise
void tortoise(void *arg)
Definition:
main.c:16
hare
void hare(void *arg)
Definition:
main.c:6
uv_thread_t
pthread_t uv_thread_t
Definition:
unix.h:136
uv.h
uv_thread_join
UV_EXTERN int uv_thread_join(uv_thread_t *tid)
Definition:
thread.c:272
uv_thread_create
UV_EXTERN int uv_thread_create(uv_thread_t *tid, uv_thread_cb entry, void *arg)
Definition:
thread.c:210
subprojects
libuv-v1.40.0
docs
code
thread-create
main.c
Generated by
1.9.1