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