posix: deprecate PTHREAD_BARRIER for POSIX_BARRIERS

The standard specifies _POSIX_BARRIERS as an Option so let's
use CONFIG_POSIX_BARRIERS for consistence.

This change deprecates CONFIG_PTHREAD_BARRIER. Users should
instead choose CONFIG_POSIX_BARRIERS.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
Chris Friedt 2024-05-22 16:51:41 -04:00 committed by David Leach
commit b639604833
7 changed files with 37 additions and 13 deletions

View file

@ -62,7 +62,7 @@ POSIX System Interfaces
_POSIX_VERSION, 200809L,
:ref:`_POSIX_ASYNCHRONOUS_IO<posix_option_asynchronous_io>`, 200809L, :ref:`†<posix_undefined_behaviour>`
:ref:`_POSIX_BARRIERS<posix_option_group_barriers>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_BARRIER`
:ref:`_POSIX_BARRIERS<posix_option_group_barriers>`, 200809L, :kconfig:option:`CONFIG_POSIX_BARRIERS`
:ref:`_POSIX_CLOCK_SELECTION<posix_option_group_clock_selection>`, 200809L, :kconfig:option:`CONFIG_POSIX_CLOCK_SELECTION`
_POSIX_MAPPED_FILES, -1, :ref:`†<posix_undefined_behaviour>`
_POSIX_MEMORY_PROTECTION, -1, :ref:`†<posix_undefined_behaviour>`

View file

@ -12,7 +12,6 @@ implementation of the POSIX API.
* :kconfig:option:`CONFIG_FNMATCH`
* :kconfig:option:`CONFIG_GETOPT`
* :kconfig:option:`CONFIG_GETOPT_LONG`
* :kconfig:option:`CONFIG_MAX_PTHREAD_BARRIER_COUNT`
* :kconfig:option:`CONFIG_MAX_PTHREAD_COUNT`
* :kconfig:option:`CONFIG_MAX_PTHREAD_KEY_COUNT`
* :kconfig:option:`CONFIG_MAX_PTHREAD_MUTEX_COUNT`
@ -35,7 +34,6 @@ implementation of the POSIX API.
* :kconfig:option:`CONFIG_POSIX_UNAME_NODENAME_LEN`
* :kconfig:option:`CONFIG_POSIX_UNAME_VERSION_LEN`
* :kconfig:option:`CONFIG_PTHREAD`
* :kconfig:option:`CONFIG_PTHREAD_BARRIER`
* :kconfig:option:`CONFIG_PTHREAD_COND`
* :kconfig:option:`CONFIG_PTHREAD_CREATE_BARRIER`
* :kconfig:option:`CONFIG_PTHREAD_IPC`

View file

@ -27,7 +27,7 @@
#define _POSIX_ASYNCHRONOUS_IO _POSIX_VERSION
#endif
#ifdef CONFIG_PTHREAD_BARRIER
#ifdef CONFIG_POSIX_BARRIERS
#define _POSIX_BARRIERS _POSIX_VERSION
#endif

View file

@ -144,7 +144,7 @@ enum {
#define __z_posix_sysconf_SC_ADVISORY_INFO (-1L)
#define __z_posix_sysconf_SC_ASYNCHRONOUS_IO \
COND_CODE_1(CONFIG_POSIX_ASYNCHRONOUS_IO, (_POSIX_ASYNCHRONOUS_IO), (-1L))
#define __z_posix_sysconf_SC_BARRIERS COND_CODE_1(CONFIG_PTHREAD_BARRIER, (_POSIX_BARRIERS), (-1L))
#define __z_posix_sysconf_SC_BARRIERS COND_CODE_1(CONFIG_POSIX_BARRIERS, (_POSIX_BARRIERS), (-1L))
#define __z_posix_sysconf_SC_CLOCK_SELECTION \
COND_CODE_1(CONFIG_POSIX_CLOCK_SELECTION, (_POSIX_CLOCK_SELECTION), (-1L))
#define __z_posix_sysconf_SC_CPUTIME \

View file

@ -38,6 +38,7 @@ zephyr_library_sources_ifdef(CONFIG_EVENTFD eventfd.c)
zephyr_library_sources_ifdef(CONFIG_FNMATCH fnmatch.c)
zephyr_library_sources_ifdef(CONFIG_GETENTROPY getentropy.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_ASYNCHRONOUS_IO aio.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_BARRIERS barrier.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_CONFSTR confstr.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_DEVICE_IO
# perror should be moved to the common libc
@ -64,7 +65,6 @@ zephyr_library_sources_ifdef(CONFIG_POSIX_TIMERS
)
zephyr_library_sources_ifdef(CONFIG_POSIX_UNAME uname.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC _common.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_BARRIER barrier.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_COND cond.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_KEY key.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_MUTEX mutex.c)

View file

@ -1,17 +1,30 @@
# Copyright (c) 2017 Intel Corporation
# Copyright (c) 2023 Meta
# Copyright (c) 2024 Tenstorrent
#
# SPDX-License-Identifier: Apache-2.0
TYPE = PTHREAD_BARRIER
type = pthread_barrier_t
type-function = pthread_barrier_wait
rsource "Kconfig.template.pooled_ipc_type"
menuconfig POSIX_BARRIERS
bool "POSIX barriers"
default y if POSIX_API
help
Select 'y' here to enable POSIX barriers.
if PTHREAD_BARRIER
For more information please see
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
if POSIX_BARRIERS
config MAX_PTHREAD_BARRIER_COUNT
int "Maximum number of POSIX barriers"
default 5
help
Maximum simultaneously active pthread_barrier_t in a POSIX application.
Note: this is a non-standard option.
config PTHREAD_CREATE_BARRIER
bool "Use a pthread_barrier_t to serialize pthread_create()"
bool "Use a POSIX barrier to serialize pthread_create()"
help
When running several SMP applications in parallel instances of Qemu,
e.g. via twister, explicit serialization may be required between
@ -21,4 +34,8 @@ config PTHREAD_CREATE_BARRIER
On such systems, say Y here to introduce explicit serialization
via pthread_barrier_wait().
endif
module = PTHREAD_BARRIER
module-str = POSIX thread barriers
source "subsys/logging/Kconfig.template.log_config"
endif # POSIX_BARRIERS

View file

@ -57,6 +57,15 @@ config POSIX_MAX_OPEN_FILES
See also CONFIG_ZVFS_OPEN_MAX.
config PTHREAD_BARRIER
bool "pthread_barrier_t support [DEPRECATED]"
select DEPRECATED
select POSIX_BARRIERS
help
This option is deprecated.
Please use CONFIG_POSIX_BARRIERS instead.
config TIMER
bool "Timer support [DEPRECATED]"
select DEPRECATED