# Copyright (c) 2017 Intel Corporation # Copyright (c) 2023 Meta # Copyright (c) 2024 Tenstorrent AI ULC # # SPDX-License-Identifier: Apache-2.0 menuconfig POSIX_THREADS bool "POSIX thread support" help Select 'y' here to enable POSIX threads, mutexes, condition variables, and thread-specific storage. For more information please see https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html if POSIX_THREADS config POSIX_THREAD_THREADS_MAX int "Maximum number of POSIX threads" default 5 help Maximum simultaneously active threads in a POSIX application. For more information, see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html config MAX_PTHREAD_MUTEX_COUNT int "Maximum number of POSIX mutexes" default 5 help Maximum simultaneously active mutexes in a POSIX application. config MAX_PTHREAD_COND_COUNT int "Maximum number of POSIX condition variables" default 5 help Maximum simultaneously active condition variables in a POSIX application. config POSIX_THREAD_KEYS_MAX int "Maximum number of POSIX thread-specific-storage keys" default 5 help Maximum simultaneously active thread-specific-storage keys in a POSIX application. For more information, see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html config PTHREAD_RECYCLER_DELAY_MS int "Delay for reclaiming dynamic pthread stacks (ms)" default 100 help Prior to a POSIX thread terminating via k_thread_abort(), scheduled work is added to the system workqueue (SWQ) so that any resources allocated by the thread (e.g. thread stack from a pool or the heap) can be released back to the system. Because resources are also freed on calls to pthread_create() there is no need to worry about resource starvation. This option sets the number of milliseconds by which to defer scheduled work. Note: this option should be considered temporary and will likely be removed once a more synchronous solution is available. config POSIX_THREAD_ATTR_STACKADDR bool "Support getting and setting POSIX thread stack addresses" help Enable this option to use pthread_attr_getstackaddr() and pthread_attr_setstackaddr(). This option was removed in IEEE 1003.1-2017 in favour of pthread_attr_getstack() and pthread_attr_setstack(). For more information, please see https://pubs.opengroup.org/onlinepubs/009696799/functions/pthread_attr_getstackaddr.html https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap03.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_08 config POSIX_THREAD_ATTR_STACKSIZE bool "Support getting and setting POSIX thread stack sizes" help Enable this option to use pthread_attr_getstacksize() or pthread_attr_setstacksize(). For more information, please see https://pubs.opengroup.org/onlinepubs/009696699/functions/pthread_attr_getstacksize.html config POSIX_THREADS_EXT bool "Extended POSIX thread support" help Enable this option to use pthread_attr_getguardsize(), pthread_attr_setguardsize(), pthread_mutexattr_gettype(), or pthread_mutexattr_settype(). For more information, please see https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html config POSIX_THREAD_PRIORITY_SCHEDULING bool "Run POSIX threads with different priorities and schedulers" help Enabling this option allows the application to configure different priorities and scheduling algorithms for different threads via functions such as pthread_setschedparam() and pthread_setschedprio(). This is required for Realtime Threads and Advanced Realtime Threads. For more information, please see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html#tag_02_01_06 https://man7.org/linux/man-pages/man7/posixoptions.7.html config POSIX_PTHREAD_ATTR_STACKSIZE_BITS int "Significant bits for pthread_attr_t stacksize" range 8 31 default 23 help This value plays a part in determining the maximum supported pthread_attr_t stacksize. Valid stacksizes are in the range [1, N], where N = 1 << M, and M is this configuration value. config POSIX_PTHREAD_ATTR_GUARDSIZE_BITS int "Significant bits for pthread_attr_t guardsize" range 1 31 default 9 help This value plays a part in determining the maximum supported pthread_attr_t guardsize. Valid guardsizes are in the range [0, N-1], where N = 1 << M, and M is this configuration value. Actual guardsize values may be rounded-up. config POSIX_PTHREAD_ATTR_GUARDSIZE_DEFAULT int "Default size of stack guard area" default 0 help This is the default amount of space to reserve at the overflow end of a pthread stack. Since Zephyr already supports both software-based stack protection (canaries) and hardware-based stack protection (MMU or MPU), this is set to 0 by default. However, a conforming application would be required to set this to PAGESIZE. Eventually, this option might facilitate a more dynamic approach to guard areas (via software or hardware) but for now it simply increases the size of thread stacks. config POSIX_THREAD_PRIO_INHERIT bool "POSIX mutex priority inheritance" help Select 'y' here to enable POSIX mutex priority inheritance. For more information, please see https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_getprotocol.html config POSIX_THREAD_PRIO_PROTECT bool "POSIX mutex priority protection" help Select 'y' here to enable POSIX mutex priority protection. For more information, please see https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_getprotocol.html config POSIX_THREAD_SAFE_FUNCTIONS bool "POSIX thread-safe functions" help Select 'y' here to enable POSIX thread-safe functions including asctime_r(), ctime_r(), flockfile(), ftrylockfile(), funlockfile(), getc_unlocked(), getchar_unlocked(), getgrgid_r(), getgrnam_r(), getpwnam_r(), getpwuid_r(), gmtime_r(), localtime_r(), putc_unlocked(), putchar_unlocked(), rand_r(), readdir_r(), strerror_r(), and strtok_r(). For more information, please see https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap02.html#tag_22_02_09_07 module = PTHREAD module-str = POSIX thread source "subsys/logging/Kconfig.template.log_config" module = PTHREAD_MUTEX module-str = POSIX mutex source "subsys/logging/Kconfig.template.log_config" module = PTHREAD_COND module-str = POSIX condition variable source "subsys/logging/Kconfig.template.log_config" module = PTHREAD_KEY module-str = POSIX thread-specific data source "subsys/logging/Kconfig.template.log_config" endif # POSIX_THREADS