From: Julian Seward Date: Fri, 24 May 2002 00:11:16 +0000 (+0000) Subject: Make syscall sched_yield just yield the current thread rather than the X-Git-Tag: svn/VALGRIND_1_0_3~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9295b3bfdafef6efda61af026a0a99d32d02ef7;p=thirdparty%2Fvalgrind.git Make syscall sched_yield just yield the current thread rather than the whole process. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@320 --- 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