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_ARCHITECTURE}/thread_start_args.h.in
7  DATA_FILES
8    ${LIBC_TARGET_ARCHITECTURE}/thread_start_args.h.in
9)
10
11add_entrypoint_object(
12  call_once
13  SRCS
14    call_once.cpp
15  HDRS
16    ../call_once.h
17  DEPENDS
18    .threads_utils
19    libc.config.linux.linux_syscall_h
20    libc.include.sys_syscall
21    libc.include.threads
22)
23
24add_header_library(
25  threads_utils
26  HDRS
27    Futex.h
28    Mutex.h
29    Thread.h
30  DEPENDS
31    .thread_start_args_h
32    libc.config.linux.linux_syscall_h
33    libc.include.sys_syscall
34    libc.include.threads
35)
36
37add_entrypoint_object(
38  thrd_create
39  SRCS
40    thrd_create.cpp
41  HDRS
42    ../thrd_create.h
43  DEPENDS
44    .threads_utils
45    libc.config.linux.linux_syscall_h
46    libc.include.errno
47    libc.include.sys_syscall
48    libc.include.threads
49    libc.src.__support.common
50    libc.src.errno.__errno_location
51    libc.src.sys.mman.mmap
52  COMPILE_OPTIONS
53    -O3
54    -fno-omit-frame-pointer # This allows us to sniff out the thread args from
55                            # the new thread's stack reliably.
56)
57
58add_entrypoint_object(
59  thrd_join
60  SRCS
61    thrd_join.cpp
62  HDRS
63    ../thrd_join.h
64  DEPENDS
65    .threads_utils
66    libc.config.linux.linux_syscall_h
67    libc.include.sys_syscall
68    libc.include.threads
69    libc.src.sys.mman.munmap
70    libc.src.__support.common
71)
72
73add_entrypoint_object(
74  mtx_init
75  SRCS
76    mtx_init.cpp
77  HDRS
78    ../mtx_init.h
79  DEPENDS
80    .threads_utils
81    libc.include.threads
82)
83
84add_entrypoint_object(
85  mtx_destroy
86  SRCS
87    mtx_destroy.cpp
88  HDRS
89    ../mtx_destroy.h
90  DEPENDS
91    .threads_utils
92    libc.include.threads
93)
94
95add_entrypoint_object(
96  mtx_lock
97  SRCS
98    mtx_lock.cpp
99  HDRS
100    ../mtx_lock.h
101  DEPENDS
102    .threads_utils
103    libc.include.threads
104)
105
106add_entrypoint_object(
107  mtx_unlock
108  SRCS
109    mtx_unlock.cpp
110  HDRS
111    ../mtx_unlock.h
112  DEPENDS
113    .threads_utils
114    libc.include.threads
115)
116
117add_entrypoint_object(
118  cnd_init
119  SRCS
120    cnd_init.cpp
121  HDRS
122    ../cnd_init.h
123  DEPENDS
124    .threads_utils
125    libc.include.threads
126)
127
128add_entrypoint_object(
129  cnd_destroy
130  SRCS
131    cnd_destroy.cpp
132  HDRS
133    ../cnd_destroy.h
134  DEPENDS
135    .threads_utils
136    libc.include.threads
137)
138
139add_entrypoint_object(
140  cnd_wait
141  SRCS
142    cnd_wait.cpp
143  HDRS
144    ../cnd_wait.h
145  DEPENDS
146    .threads_utils
147    libc.include.threads
148)
149
150add_entrypoint_object(
151  cnd_signal
152  SRCS
153    cnd_signal.cpp
154  HDRS
155    ../cnd_signal.h
156  DEPENDS
157    .threads_utils
158    libc.include.threads
159)
160
161add_entrypoint_object(
162  cnd_broadcast
163  SRCS
164    cnd_broadcast.cpp
165  HDRS
166    ../cnd_broadcast.h
167  DEPENDS
168    .threads_utils
169    libc.include.threads
170)
171