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    -fno-omit-frame-pointer # This allows us to sniff out the thread args from
54                            # the new thread's stack reliably.
55)
56
57add_entrypoint_object(
58  thrd_join
59  SRCS
60    thrd_join.cpp
61  HDRS
62    ../thrd_join.h
63  DEPENDS
64    .threads_utils
65    libc.config.linux.linux_syscall_h
66    libc.include.sys_syscall
67    libc.include.threads
68    libc.src.sys.mman.munmap
69    libc.src.__support.common
70)
71
72add_entrypoint_object(
73  mtx_init
74  SRCS
75    mtx_init.cpp
76  HDRS
77    ../mtx_init.h
78  DEPENDS
79    .threads_utils
80    libc.include.threads
81)
82
83add_entrypoint_object(
84  mtx_lock
85  SRCS
86    mtx_lock.cpp
87  HDRS
88    ../mtx_lock.h
89  DEPENDS
90    .threads_utils
91    libc.include.threads
92)
93
94add_entrypoint_object(
95  mtx_unlock
96  SRCS
97    mtx_unlock.cpp
98  HDRS
99    ../mtx_unlock.h
100  DEPENDS
101    .threads_utils
102    libc.include.threads
103)
104