public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] linux: Implement sched_yield in C
@ 2023-06-07 19:46 Noah Goldstein
  2023-06-07 19:46 ` [PATCH v1 2/2] x86: Add `prepare_context_switch` to initialize register inuse states Noah Goldstein
  2023-06-07 20:43 ` [PATCH v1 1/2] linux: Implement sched_yield in C H.J. Lu
  0 siblings, 2 replies; 7+ messages in thread
From: Noah Goldstein @ 2023-06-07 19:46 UTC (permalink / raw)
  To: libc-alpha; +Cc: goldstein.w.n, hjl.tools, carlos

This is in preperation for a minor optimization before expected
context switches.
---
 sysdeps/unix/sysv/linux/sched_yield.c | 27 +++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/syscalls.list |  1 -
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/unix/sysv/linux/sched_yield.c

diff --git a/sysdeps/unix/sysv/linux/sched_yield.c b/sysdeps/unix/sysv/linux/sched_yield.c
new file mode 100644
index 0000000000..154bf725b0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sched_yield.c
@@ -0,0 +1,27 @@
+/* Yield current process.  Linux specific syscall.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+int
+__sched_yield (void)
+{
+    return INLINE_SYSCALL_CALL (sched_yield);
+}
+libc_hidden_def (__sched_yield);
+weak_alias (__sched_yield, sched_yield)
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 73e941ef89..5f571df937 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -59,7 +59,6 @@ sched_primax	-	sched_get_priority_max	i:i	__sched_get_priority_max	sched_get_pri
 sched_primin	-	sched_get_priority_min	i:i	__sched_get_priority_min	sched_get_priority_min
 sched_setp	-	sched_setparam	i:ip	__sched_setparam	sched_setparam
 sched_sets	-	sched_setscheduler	i:iip	__sched_setscheduler	sched_setscheduler
-sched_yield	-	sched_yield	i:	__sched_yield	sched_yield
 setfsgid	EXTRA	setfsgid	i:i	setfsgid
 setfsuid	EXTRA	setfsuid	i:i	setfsuid
 setpgid		-	setpgid		i:ii	__setpgid	setpgid
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-08  9:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 19:46 [PATCH v1 1/2] linux: Implement sched_yield in C Noah Goldstein
2023-06-07 19:46 ` [PATCH v1 2/2] x86: Add `prepare_context_switch` to initialize register inuse states Noah Goldstein
2023-06-07 20:46   ` H.J. Lu
2023-06-07 21:59     ` Noah Goldstein
2023-06-08  9:01       ` Noah Goldstein
2023-06-07 20:43 ` [PATCH v1 1/2] linux: Implement sched_yield in C H.J. Lu
2023-06-08  9:01   ` Noah Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).