posix: deprecate PTHREAD_SPINLOCK for POSIX_SPIN_LOCKS

This change deprecates CONFIG_PTHREAD_SPINLOCK in favour of
CONFIG_POSIX_SPIN_LOCKS, which maps directly to the name of the
standard POSIX Option Group.

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

View file

@ -69,7 +69,7 @@ POSIX System Interfaces
:ref:`_POSIX_READER_WRITER_LOCKS<posix_option_reader_writer_locks>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_IPC`
:ref:`_POSIX_REALTIME_SIGNALS<posix_option_group_realtime_signals>`, -1,
:ref:`_POSIX_SEMAPHORES<posix_option_group_semaphores>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_IPC`
:ref:`_POSIX_SPIN_LOCKS<posix_option_group_spin_locks>`, 200809L, :kconfig:option:`CONFIG_PTHREAD_SPINLOCK`
:ref:`_POSIX_SPIN_LOCKS<posix_option_group_spin_locks>`, 200809L, :kconfig:option:`CONFIG_POSIX_SPIN_LOCKS`
:ref:`_POSIX_THREAD_SAFE_FUNCTIONS<posix_thread_safe_functions>`, -1,
:ref:`_POSIX_THREADS<posix_option_group_threads_base>`, -1, :kconfig:option:`CONFIG_PTHREAD_IPC`
:ref:`_POSIX_TIMEOUTS<posix_option_timeouts>`, 200809L, :kconfig:option:`CONFIG_POSIX_TIMEOUTS`

View file

@ -39,6 +39,5 @@ implementation of the POSIX API.
* :kconfig:option:`CONFIG_PTHREAD_KEY`
* :kconfig:option:`CONFIG_PTHREAD_MUTEX`
* :kconfig:option:`CONFIG_PTHREAD_RECYCLER_DELAY_MS`
* :kconfig:option:`CONFIG_PTHREAD_SPINLOCK`
* :kconfig:option:`CONFIG_SEM_VALUE_MAX`
* :kconfig:option:`CONFIG_TIMER_CREATE_WAIT`

View file

@ -87,7 +87,7 @@
/* #define _POSIX_SHELL (-1L) */
/* #define _POSIX_SPAWN (-1L) */
#ifdef CONFIG_PTHREAD_SPINLOCK
#ifdef CONFIG_POSIX_SPIN_LOCKS
#define _POSIX_SPIN_LOCKS _POSIX_VERSION
#endif

View file

@ -178,7 +178,7 @@ enum {
#define __z_posix_sysconf_SC_SHELL (-1L)
#define __z_posix_sysconf_SC_SPAWN (-1L)
#define __z_posix_sysconf_SC_SPIN_LOCKS \
COND_CODE_1(CONFIG_PTHREAD_SPINLOCK, (_POSIX_SPIN_LOCKS), (-1L))
COND_CODE_1(CONFIG_POSIX_SPIN_LOCKS, (_POSIX_SPIN_LOCKS), (-1L))
#define __z_posix_sysconf_SC_SPORADIC_SERVER (-1L)
#define __z_posix_sysconf_SC_SS_REPL_MAX _POSIX_SS_REPL_MAX
#define __z_posix_sysconf_SC_SYNCHRONIZED_IO (-1L)

View file

@ -62,6 +62,7 @@ zephyr_library_sources_ifdef(CONFIG_POSIX_SINGLE_PROCESS
sysconf.c
uname.c
)
zephyr_library_sources_ifdef(CONFIG_POSIX_SPIN_LOCKS spinlock.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_SYSLOG syslog.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_TIMERS
clock.c
@ -75,7 +76,6 @@ zephyr_library_sources_ifdef(CONFIG_PTHREAD pthread.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_RWLOCK rwlock.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_PRIORITY_SCHEDULING sched.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC semaphore.c)
zephyr_library_sources_ifdef(CONFIG_PTHREAD_SPINLOCK spinlock.c)
zephyr_library_include_directories(
${ZEPHYR_BASE}/kernel/include

View file

@ -102,6 +102,15 @@ config PTHREAD_BARRIER
Please use CONFIG_POSIX_BARRIERS instead.
config PTHREAD_SPINLOCK
bool "pthread_spinlock_t support [DEPRECATED]"
select DEPRECATED
select POSIX_SPIN_LOCKS
help
This option is deprecated.
Please use CONFIG_POSIX_SPIN_LOCKS instead.
config TIMER
bool "Timer support [DEPRECATED]"
select DEPRECATED

View file

@ -2,7 +2,27 @@
#
# SPDX-License-Identifier: Apache-2.0
TYPE = PTHREAD_SPINLOCK
type = pthread_spinlock_t
type-function = pthread_spin_lock
rsource "Kconfig.template.pooled_ipc_type"
menuconfig POSIX_SPIN_LOCKS
bool "POSIX spin locks"
default y if POSIX_API
help
Select 'y' here to enable POSIX spin locks.
For more information please see
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
if POSIX_SPIN_LOCKS
config MAX_PTHREAD_SPINLOCK_COUNT
int "Maximum number of POSIX spin locks"
default 5
help
Maximum simultaneously active spin locks in a POSIX application.
Note: this is a non-standard option.
module = PTHREAD_SPINLOCK
module-str = POSIX Spin Locks
source "subsys/logging/Kconfig.template.log_config"
endif # POSIX_SPIN_LOCKS