summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHal G <systemdlete@fastmail.com>2020-08-18 15:36:15 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-08-18 15:38:02 -0500
commitaa649428f2d294c03b50b0bc9e11b51296bab008 (patch)
tree0ddd0e14614c7c0b814573fdd2d92db1026f0414
parent2d7599351787c5c9db78560923ed226e29ebe02f (diff)
downloadgcompat-aa649428f2d294c03b50b0bc9e11b51296bab008.tar.gz
gcompat-aa649428f2d294c03b50b0bc9e11b51296bab008.tar.bz2
gcompat-aa649428f2d294c03b50b0bc9e11b51296bab008.tar.xz
gcompat-aa649428f2d294c03b50b0bc9e11b51296bab008.zip
pthread: Add pthread_yield()
Calls the more standard sched_yield().
-rw-r--r--CHANGELOG.rst9
-rw-r--r--libgcompat/pthread.c9
2 files changed, 18 insertions, 0 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index f3bd158..a430e05 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -8,6 +8,15 @@
© 2016-2019 Adélie Linux and contributors. NCSA open source licence.
+0.9.1 (2020-08-??)
+==================
+
+pthread
+-------
+
+* Add pthread_yield from Hal G.
+
+
0.9.0 (2020-07-06)
==================
diff --git a/libgcompat/pthread.c b/libgcompat/pthread.c
index f15e9f1..4357d74 100644
--- a/libgcompat/pthread.c
+++ b/libgcompat/pthread.c
@@ -2,6 +2,7 @@
#include <errno.h> /* errno */
#include <fcntl.h> /* O_CLOEXEC, O_RDONLY */
#include <pthread.h> /* pthread_atfork */
+#include <sched.h> /* sched_yield */
#include <unistd.h> /* open, read */
#include "alias.h" /* weak_alias */
@@ -52,3 +53,11 @@ int pthread_getname_np(pthread_t thread, char *name, size_t len)
return 0;
}
+
+/**
+ * Yield this thread.
+ */
+int pthread_yield(void)
+{
+ return sched_yield();
+}