]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make syscall sched_yield just yield the current thread rather than the
authorJulian Seward <jseward@acm.org>
Fri, 24 May 2002 00:11:16 +0000 (00:11 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 24 May 2002 00:11:16 +0000 (00:11 +0000)
whole process.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@320

coregrind/vg_scheduler.c
vg_scheduler.c

index 801502b91633a2e1786f1cd7282eeeda4148e1fc..c4876f85bdf36568a4e21dc607bc672b55846f25 100644 (file)
@@ -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
index 801502b91633a2e1786f1cd7282eeeda4148e1fc..c4876f85bdf36568a4e21dc607bc672b55846f25 100644 (file)
@@ -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