diff options
| author | Florian Weimer <fweimer@redhat.com> | 2021-05-03 09:23:17 +0200 |
|---|---|---|
| committer | Florian Weimer <fweimer@redhat.com> | 2021-05-03 09:23:44 +0200 |
| commit | c2fd60a5861efef48252f5cc7efc70e1d8a0da9a (patch) | |
| tree | 73039b111fb8f291dfcd4cc91b9f037f82ceda93 | |
| parent | 0505ae4e3b6d18b7ed1ec4c9b2d7e890acadec93 (diff) | |
| download | glibc-c2fd60a5861efef48252f5cc7efc70e1d8a0da9a.tar.xz glibc-c2fd60a5861efef48252f5cc7efc70e1d8a0da9a.zip | |
nptl: Move pthread_yield into libc, as a compatibility symbol
And deprecate it in <pthread.h>, redirecting it to sched_yield
for the time being.
The symbol was moved using scripts/move-symbol-to-libc.py.
No GLIBC_2.34 symbol version is added because of the compatibility
symbol status.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
66 files changed, 53 insertions, 40 deletions
@@ -32,6 +32,9 @@ Deprecated and removed features, and other changes affecting compatibility: programs should use the equivalent standard function pthread_mutexattr_setrobust instead. +* The function pthread_yield has been deprecated; programs should use + the equivalent standard function sched_yield instead. + Changes to build and runtime requirements: * On Linux, the shm_open, sem_open, and related functions now expect the diff --git a/nptl/Makefile b/nptl/Makefile index e3f9a2053a..38f2715c2c 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -148,6 +148,7 @@ routines = \ pthread_spin_lock \ pthread_spin_trylock \ pthread_spin_unlock \ + pthread_yield \ tpp \ unwind \ @@ -201,7 +202,6 @@ libpthread-routines = \ pthread_testcancel \ pthread_timedjoin \ pthread_tryjoin \ - pthread_yield \ sem_clockwait \ sem_close \ sem_destroy \ diff --git a/nptl/Versions b/nptl/Versions index 9c92e9ec84..008a344f0d 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -100,6 +100,7 @@ libc { pthread_spin_unlock; pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock; + pthread_yield; } GLIBC_2.2.3 { pthread_getattr_np; @@ -354,6 +355,8 @@ libpthread { pthread_barrierattr_setpshared; pthread_getcpuclockid; pthread_yield; + pthread_rwlock_timedrdlock; + pthread_rwlock_timedwrlock; sem_timedwait; } diff --git a/nptl/pthread_yield.c b/nptl/pthread_yield.c index b9eecd578d..638d6a3e68 100644 --- a/nptl/pthread_yield.c +++ b/nptl/pthread_yield.c @@ -18,12 +18,13 @@ #include <pthread.h> #include <sched.h> +#include <shlib-compat.h> - -/* With the 1-on-1 model we implement this function is equivalent to - the 'sched_yield' function. */ -int -pthread_yield (void) +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_34) +int attribute_compat_text_section +__pthread_yield (void) { - return sched_yield (); + return __sched_yield (); } +compat_symbol (libpthread, __pthread_yield, pthread_yield, GLIBC_2_2); +#endif /* OTHER_SHLIB_COMPAT */ diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index af0c156c89..22e037dcb4 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -454,11 +454,14 @@ extern int pthread_setconcurrency (int __level) __THROW; #endif #ifdef __USE_GNU -/* Yield the processor to another thread or process. - This function is similar to the POSIX `sched_yield' function but - might be differently implemented in the case of a m-on-n thread - implementation. */ extern int pthread_yield (void) __THROW; +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield) + __attribute_deprecated_msg__ ("\ +pthread_yield is deprecated, use sched_yield instead"); +# else +# define pthread_yield sched_yield +# endif /* Limit specified thread TH to run only on the processors represented diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index ad9f34494f..aad440cc6a 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -1530,6 +1530,7 @@ GLIBC_2.17 pthread_spin_init F GLIBC_2.17 pthread_spin_lock F GLIBC_2.17 pthread_spin_trylock F GLIBC_2.17 pthread_spin_unlock F +GLIBC_2.17 pthread_yield F GLIBC_2.17 ptrace F GLIBC_2.17 ptsname F GLIBC_2.17 ptsname_r F diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist index 433b97f293..c1f11e12df 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist @@ -40,7 +40,6 @@ GLIBC_2.17 pthread_sigqueue F GLIBC_2.17 pthread_testcancel F GLIBC_2.17 pthread_timedjoin_np F GLIBC_2.17 pthread_tryjoin_np F -GLIBC_2.17 pthread_yield F GLIBC_2.17 sem_close F GLIBC_2.17 sem_destroy F GLIBC_2.17 sem_getvalue F diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 1a97584f0d..e0deca069c 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -2004,6 +2004,7 @@ GLIBC_2.2 pthread_spin_init F GLIBC_2.2 pthread_spin_lock F GLIBC_2.2 pthread_spin_trylock F GLIBC_2.2 pthread_spin_unlock F +GLIBC_2.2 pthread_yield F GLIBC_2.2 putwc F GLIBC_2.2 putwc_unlocked F GLIBC_2.2 putwchar F diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist index e46d8b6b61..5eae00fd6b 100644 --- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist @@ -49,7 +49,6 @@ GLIBC_2.2 pthread_barrierattr_destroy F GLIBC_2.2 pthread_barrierattr_init F GLIBC_2.2 pthread_barrierattr_setpshared F GLIBC_2.2 pthread_getcpuclockid F -GLIBC_2.2 pthre |
