1add_gen_header(
2  thread_start_args_h
3  DEF_FILE thread_start_args.h.def
4  GEN_HDR thread_start_args.h
5  PARAMS
6    thread_start_args=${LIBC_TARGET_MACHINE}/thread_start_args.h.in
7  DATA_FILES
8    ${LIBC_TARGET_MACHINE}/thread_start_args.h.in
9)
10
11add_header_library(
12  threads_utils
13  HDRS
14    thread_utils.h
15  DEPENDS
16    .thread_start_args_h
17)
18
19add_entrypoint_object(
20  thrd_create
21  SRCS
22    thrd_create.cpp
23  HDRS
24    ../thrd_create.h
25  DEPENDS
26    .threads_utils
27    libc.config.linux.linux_syscall_h
28    libc.include.errno
29    libc.include.sys_syscall
30    libc.include.threads
31    libc.src.__support.common
32    libc.src.errno.__errno_location
33    libc.src.sys.mman.mmap
34  COMPILE_OPTIONS
35    -fno-omit-frame-pointer # This allows us to sniff out the thread args from
36                            # the new thread's stack reliably.
37)
38
39add_entrypoint_object(
40  thrd_join
41  SRCS
42    thrd_join.cpp
43  HDRS
44    ../thrd_join.h
45  DEPENDS
46    .threads_utils
47    libc.config.linux.linux_syscall_h
48    libc.include.sys_syscall
49    libc.include.threads
50    libc.src.sys.mman.mmap
51    libc.src.__support.common
52)
53
54add_entrypoint_object(
55  mtx_init
56  SRCS
57    mtx_init.cpp
58  HDRS
59    ../mtx_init.h
60  DEPENDS
61    .threads_utils
62    libc.include.threads
63)
64
65add_entrypoint_object(
66  mtx_lock
67  SRCS
68    mtx_lock.cpp
69  HDRS
70    ../mtx_lock.h
71  DEPENDS
72    .threads_utils
73    libc.config.linux.linux_syscall_h
74    libc.include.sys_syscall
75    libc.include.threads
76)
77
78add_entrypoint_object(
79  mtx_unlock
80  SRCS
81    mtx_unlock.cpp
82  HDRS
83    ../mtx_unlock.h
84  DEPENDS
85    .threads_utils
86    libc.config.linux.linux_syscall_h
87    libc.include.sys_syscall
88    libc.include.threads
89)
90