summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-03 09:23:17 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-03 09:23:44 +0200
commitc2fd60a5861efef48252f5cc7efc70e1d8a0da9a (patch)
tree73039b111fb8f291dfcd4cc91b9f037f82ceda93 /nptl
parent0505ae4e3b6d18b7ed1ec4c9b2d7e890acadec93 (diff)
downloadglibc-c2fd60a5861efef48252f5cc7efc70e1d8a0da9a.tar.gz
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>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/Versions3
-rw-r--r--nptl/pthread_yield.c13
3 files changed, 11 insertions, 7 deletions
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 */