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.CPP.atomic
22    libc.src.__support.OSUtil.osutil
23)
24
25add_header_library(
26  threads_utils
27  HDRS
28    CndVar.h
29    Futex.h
30    Thread.h
31  DEPENDS
32    .thread_start_args_h
33    libc.include.sys_syscall
34    libc.include.threads
35    libc.src.__support.CPP.atomic
36    libc.src.__support.OSUtil.osutil
37    libc.src.__support.threads.thread
38)
39
40add_entrypoint_object(
41  thrd_create
42  SRCS
43    thrd_create.cpp
44  HDRS
45    ../thrd_create.h
46  DEPENDS
47    .threads_utils
48    libc.include.errno
49    libc.include.sys_syscall
50    libc.include.threads
51    libc.src.__support.common
52    libc.src.__support.OSUtil.osutil
53    libc.src.errno.errno
54    libc.src.sys.mman.mmap
55  COMPILE_OPTIONS
56    -O3
57    -fno-omit-frame-pointer # This allows us to sniff out the thread args from
58                            # the new thread's stack reliably.
59)
60
61add_entrypoint_object(
62  thrd_join
63  SRCS
64    thrd_join.cpp
65  HDRS
66    ../thrd_join.h
67  DEPENDS
68    .threads_utils
69    libc.include.sys_syscall
70    libc.include.threads
71    libc.src.__support.CPP.atomic
72    libc.src.__support.common
73    libc.src.__support.OSUtil.osutil
74    libc.src.sys.mman.munmap
75)
76
77add_entrypoint_object(
78  cnd_init
79  SRCS
80    cnd_init.cpp
81  HDRS
82    ../cnd_init.h
83  DEPENDS
84    .threads_utils
85    libc.include.threads
86)
87
88add_entrypoint_object(
89  cnd_destroy
90  SRCS
91    cnd_destroy.cpp
92  HDRS
93    ../cnd_destroy.h
94  DEPENDS
95    .threads_utils
96    libc.include.threads
97)
98
99add_entrypoint_object(
100  cnd_wait
101  SRCS
102    cnd_wait.cpp
103  HDRS
104    ../cnd_wait.h
105  DEPENDS
106    .threads_utils
107    libc.include.threads
108    libc.src.__support.threads.thread
109)
110
111add_entrypoint_object(
112  cnd_signal
113  SRCS
114    cnd_signal.cpp
115  HDRS
116    ../cnd_signal.h
117  DEPENDS
118    .threads_utils
119    libc.include.threads
120)
121
122add_entrypoint_object(
123  cnd_broadcast
124  SRCS
125    cnd_broadcast.cpp
126  HDRS
127    ../cnd_broadcast.h
128  DEPENDS
129    .threads_utils
130    libc.include.threads
131)
132