136 lines · plain
1add_header_library(2 futex_word_type3 HDRS4 futex_word.h5 DEPENDS6 libc.hdr.stdint_proxy7)8 9if(NOT TARGET libc.src.__support.OSUtil.osutil)10 return()11endif()12 13add_header_library(14 futex_utils15 HDRS16 futex_utils.h17 DEPENDS18 .futex_word_type19 libc.include.sys_syscall20 libc.src.__support.OSUtil.osutil21 libc.src.__support.CPP.atomic22 libc.src.__support.CPP.limits23 libc.src.__support.CPP.optional24 libc.src.__support.time.linux.abs_timeout25)26 27set(monotonicity_flags)28if (LIBC_CONF_TIMEOUT_ENSURE_MONOTONICITY)29 set(monotonicity_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1)30else()31 set(monotonicity_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=0)32endif()33 34add_header_library(35 raw_mutex36 HDRS37 mutex.h38 DEPENDS39 .futex_utils40 libc.src.__support.threads.sleep41 libc.src.__support.time.linux.abs_timeout42 libc.src.__support.time.linux.monotonicity43 libc.src.__support.CPP.optional44 libc.hdr.types.pid_t45 COMPILE_OPTIONS46 -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=${LIBC_CONF_RAW_MUTEX_DEFAULT_SPIN_COUNT}47 ${monotonicity_flags}48)49 50add_header_library(51 rwlock52 HDRS53 rwlock.h54 DEPENDS55 .futex_utils56 .raw_mutex57 libc.src.__support.common58 libc.src.__support.OSUtil.osutil59 libc.src.__support.CPP.limits60 libc.src.__support.threads.identifier61 COMPILE_OPTIONS62 -DLIBC_COPT_RWLOCK_DEFAULT_SPIN_COUNT=${LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT}63 ${monotonicity_flags}64)65 66add_header_library(67 mutex68 HDRS69 mutex.h70 DEPENDS71 .futex_utils72 .raw_mutex73 libc.src.__support.threads.mutex_common74)75 76add_object_library(77 thread78 SRCS79 thread.cpp80 DEPENDS81 .futex_utils82 libc.config.app_h83 libc.include.sys_syscall84 libc.hdr.fcntl_macros85 libc.src.errno.errno86 libc.src.__support.CPP.atomic87 libc.src.__support.CPP.stringstream88 libc.src.__support.CPP.string_view89 libc.src.__support.common90 libc.src.__support.error_or91 libc.src.__support.threads.thread_common92 COMPILE_OPTIONS93 ${libc_opt_high_flag}94 -fno-omit-frame-pointer # This allows us to sniff out the thread args from95 # the new thread's stack reliably.96 -Wno-frame-address # Yes, calling __builtin_return_address with a97 # value other than 0 is dangerous. We know.98)99 100add_header_library(101 callonce102 HDRS103 ../callonce.h104 callonce.h105 DEPENDS106 .futex_utils107 libc.src.__support.macros.optimization108)109 110add_object_library(111 CndVar112 SRCS113 CndVar.cpp114 HDRS115 ../CndVar.h116 DEPENDS117 libc.hdr.stdint_proxy118 libc.include.sys_syscall119 libc.src.__support.OSUtil.osutil120 libc.src.__support.threads.linux.futex_word_type121 libc.src.__support.threads.mutex122 libc.src.__support.threads.linux.raw_mutex123 libc.src.__support.CPP.mutex124)125 126add_object_library(127 barrier128 HDRS129 barrier.h130 SRCS131 barrier.cpp132 DEPENDS133 libc.src.__support.threads.CndVar134 libc.src.__support.threads.mutex135)136