zephyr/lib/posix
Christopher Friedt e49ae776cc posix: pthread: implement pthread_getconcurrency()
Zephyr must support all functionality of the XSI_THREADS_EXT
subprofiling option group in order to claim it supports that
subprofiling option group.

The XSI_THREADS_EXT option group is critical to be able to
run POSIX threads with statically allocated thread stacks, which
has been a feature of the implementation since it was initially
added.

The pthread_getconcurrency() and pthread_setconcurrency()
functions are the only remaining, unimplemented functions of
the XSI_THREADS_EXT option group.

Implement pthread_getconcurrency() and pthread_setconcurrency()
via the more "posixly correct" interpretation of the
specification.

I.e. as the pthread_t:k_thread relationship is 1:1 and not M:N,
Zephyr does not support multiplexing of user threads on top of
schedulable kernel entities (i.e. "user threads" are directly
mapped to native threads, just like linuxthreads or NPTL are in
Linux).

For that reason, to be "posixly correct", we should save the
provided value via pthread_setconcurrency(), in the absense of
errors, and also return that same value back via
pthread_getconcurrency(), even though that serves zero purpose
in Zephyr for the foreseeable future.

Note: the specification also states
"an implementation can always ignore any calls to
pthread_setconcurrency() and return a constant for
pthread_getconcurrency()."

For that reason, the implementation may be revisited at a later
time when when considering optimizations and when there is a
better system in place for documenting deviations.

Any such optimization should be explicitly controlled via
Kconfig.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-11-27 08:26:31 -05:00
..
getopt
CMakeLists.txt
Kconfig
Kconfig.barrier
Kconfig.clock
Kconfig.cond
Kconfig.eventfd
Kconfig.fnmatch
Kconfig.fs
Kconfig.getopt
Kconfig.key
Kconfig.limits
Kconfig.mqueue
Kconfig.mutex
Kconfig.pthread
Kconfig.semaphore
Kconfig.signal
Kconfig.spinlock
Kconfig.template.pooled_ipc_type
Kconfig.template.pooled_type
Kconfig.template.with_logging
Kconfig.template.with_url
Kconfig.timer
Kconfig.uname
_common.c
barrier.c
clock.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
cond.c
eventfd.c
fnmatch.c
fs.c
key.c posix: pthread: ensure pthread_key_delete() removes correct key 2023-11-24 10:47:28 -05:00
mqueue.c
mutex.c
nanosleep.c
perror.c
posix_internal.h posix: pthread: support for pthread_setcanceltype() 2023-11-26 05:55:08 -05:00
pthread.c posix: pthread: implement pthread_getconcurrency() 2023-11-27 08:26:31 -05:00
pthread_sched.h
rwlock.c
sched.c
semaphore.c
signal.c
sleep.c
spinlock.c
timer.c
uname.c