From c9295b3bfdafef6efda61af026a0a99d32d02ef7 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Fri, 24 May 2002 00:11:16 +0000 Subject: [PATCH] Make syscall sched_yield just yield the current thread rather than the whole process. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@320 --- coregrind/vg_scheduler.c | 9 +++++++++ vg_scheduler.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 801502b916..c4876f85bd 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -1388,9 +1388,18 @@ VgSchedReturnCode VG_(scheduler) ( void ) } # endif + /* Is the client exiting for good? */ if (VG_(threads)[tid].m_eax == __NR_exit) return VgSrc_ExitSyscall; + /* Trap syscalls to __NR_sched_yield and just have this + thread yield instead. Not essential, just an + optimisation. */ + if (VG_(threads)[tid].m_eax == __NR_sched_yield) { + SET_EAX(tid, 0); /* syscall returns with success */ + goto stage1; /* find a new thread to run */ + } + sched_do_syscall(tid); # if 0 diff --git a/vg_scheduler.c b/vg_scheduler.c index 801502b916..c4876f85bd 100644 --- a/vg_scheduler.c +++ b/vg_scheduler.c @@ -1388,9 +1388,18 @@ VgSchedReturnCode VG_(scheduler) ( void ) } # endif + /* Is the client exiting for good? */ if (VG_(threads)[tid].m_eax == __NR_exit) return VgSrc_ExitSyscall; + /* Trap syscalls to __NR_sched_yield and just have this + thread yield instead. Not essential, just an + optimisation. */ + if (VG_(threads)[tid].m_eax == __NR_sched_yield) { + SET_EAX(tid, 0); /* syscall returns with success */ + goto stage1; /* find a new thread to run */ + } + sched_do_syscall(tid); # if 0 -- 2.47.2