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_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    thread_utils.h
28  DEPENDS
29    .thread_start_args_h
30)
31
32add_entrypoint_object(
33  thrd_create
34  SRCS
35    thrd_create.cpp
36  HDRS
37    ../thrd_create.h
38  DEPENDS
39    .threads_utils
40    libc.config.linux.linux_syscall_h
41    libc.include.errno
42    libc.include.sys_syscall
43    libc.include.threads
44    libc.src.__support.common
45    libc.src.errno.__errno_location
46    libc.src.sys.mman.mmap
47  COMPILE_OPTIONS
48    -fno-omit-frame-pointer # This allows us to sniff out the thread args from
49                            # the new thread's stack reliably.
50)
51
52add_entrypoint_object(
53  thrd_join
54  SRCS
55    thrd_join.cpp
56  HDRS
57    ../thrd_join.h
58  DEPENDS
59    .threads_utils
60    libc.config.linux.linux_syscall_h
61    libc.include.sys_syscall
62    libc.include.threads
63    libc.src.sys.mman.munmap
64    libc.src.__support.common
65)
66
67add_entrypoint_object(
68  mtx_init
69  SRCS
70    mtx_init.cpp
71  HDRS
72    ../mtx_init.h
73  DEPENDS
74    .threads_utils
75    libc.include.threads
76)
77
78add_entrypoint_object(
79  mtx_lock
80  SRCS
81    mtx_lock.cpp
82  HDRS
83    ../mtx_lock.h
84  DEPENDS
85    .threads_utils
86    libc.config.linux.linux_syscall_h
87    libc.include.sys_syscall
88    libc.include.threads
89)
90
91add_entrypoint_object(
92  mtx_unlock
93  SRCS
94    mtx_unlock.cpp
95  HDRS
96    ../mtx_unlock.h
97  DEPENDS
98    .threads_utils
99    libc.config.linux.linux_syscall_h
100    libc.include.sys_syscall
101    libc.include.threads
102)
103