posix: deprecate PTHREAD_IPC _MUTEX _COND and _KEY
Zephyr's POSIX API is moving toward using the standard nomenclature from IEEE 1003.1-2017 for as much as possible. In particular, we want to have consistent naming between Zephyr's POSIX API Kconfig options and the naming for POSIX Options and Option Groups. The Kconfig option CONFIG_PTHREAD_IPC has been (ab)used for a very long time for a variety of different purposes. However, the standard Option / feature test macro for POSIX Threads is, intuitively _POSIX_THREADS. There is a corresponding sysconf() key named _SC_POSIX_THREADS. Annoyingly, the POSIX Option Group that corresponds to the Option is POSIX_THREADS_BASE, which is a minor inconsistency in the standard. The _POSIX_THREADS Option already includes mutexes, condition variables, and thread-specific storage (keys). So with this change, we also deprecate the redundant Kconfig variables that do not have a corresponding match in the standard. - CONFIG_PTHREAD_IPC - CONFIG_PTHREAD - CONFIG_PTHREAD_COND - CONFIG_PTHREAD_MUTEX - CONFIG_PTHREAD_KEY Additionally, create Kconfig variables for those configurables which we are lacking: - CONFIG_POSIX_THREADS_EXT - CONFIG_POSIX_THREAD_ATTR_STACKSIZE - CONFIG_POSIX_THREAD_ATTR_STACKADDR - CONFIG_POSIX_THREAD_PRIORITY_SCHEDULING - CONFIG_POSIX_THREAD_PRIO_INHERIT - CONFIG_POSIX_THREAD_PRIO_PROTECT - CONFIG_POSIX_THREAD_SAFE_FUNCTIONS Some Kconfig variables were renamed to more properly match the spec: - CONFIG_MAX_PTHREAD_COUNT -> CONFIG_POSIX_THREAD_THREADS_MAX - CONFIG_MAX_PTHREAD_KEY_COUNT -> CONFIG_POSIX_THREAD_KEYS_MAX Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
2f2cad742e
commit
fcebe60090
36 changed files with 349 additions and 211 deletions
|
@ -1,14 +1,50 @@
|
|||
# Copyright (c) 2017 Intel Corporation
|
||||
# Copyright (c) 2023 Meta
|
||||
# Copyright (c) 2024 Tenstorrent AI ULC
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
TYPE = PTHREAD
|
||||
type = pthread_t
|
||||
type-function = pthread_create
|
||||
rsource "Kconfig.template.pooled_ipc_type"
|
||||
menuconfig POSIX_THREADS
|
||||
bool "POSIX thread support"
|
||||
default y if POSIX_API
|
||||
help
|
||||
Select 'y' here to enable POSIX threads, mutexes, condition variables, and thread-specific
|
||||
storage.
|
||||
|
||||
if PTHREAD
|
||||
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)"
|
||||
|
@ -27,6 +63,54 @@ config PTHREAD_RECYCLER_DELAY_MS
|
|||
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"
|
||||
default y
|
||||
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"
|
||||
default y
|
||||
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"
|
||||
default y
|
||||
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"
|
||||
default y
|
||||
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
|
||||
|
@ -59,4 +143,50 @@ config POSIX_PTHREAD_ATTR_GUARDSIZE_DEFAULT
|
|||
facilitate a more dynamic approach to guard areas (via software or
|
||||
hardware) but for now it simply increases the size of thread stacks.
|
||||
|
||||
endif
|
||||
config POSIX_THREAD_PRIO_INHERIT
|
||||
bool "POSIX mutex priority inheritance"
|
||||
default y
|
||||
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"
|
||||
default y
|
||||
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"
|
||||
default y
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue