]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make VG_USERREQ__PTHREAD_YIELD actually yield the thread. This used
authorJulian Seward <jseward@acm.org>
Fri, 12 Jul 2002 22:30:51 +0000 (22:30 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 12 Jul 2002 22:30:51 +0000 (22:30 +0000)
to work but was broken in a subtle way by the cleanup of rev 1.70.

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

coregrind/vg_scheduler.c
vg_scheduler.c

index 74af761290a7d6e37006158d803d30f0caec817f..6a99730bebf5c2b852f30b9550eb7a4dce8513bd 100644 (file)
@@ -1319,13 +1319,14 @@ VgSchedReturnCode VG_(scheduler) ( void )
          }
 
          if (trc == VG_TRC_EBP_JMP_CLIENTREQ) {
-            /* VG_(printf)("request 0x%x\n", 
-                           *(UInt*)(VG_(threads)[tid].m_eax)); */
+            UInt reqno = *(UInt*)(VG_(threads)[tid].m_eax);
+            /* VG_(printf)("request 0x%x\n", reqno); */
             do_client_request(tid);
             /* Following the request, we try and continue with the
                same thread if still runnable.  If not, go back to
                Stage 1 to select a new thread to run. */
-            if (VG_(threads)[tid].status == VgTs_Runnable)
+            if (VG_(threads)[tid].status == VgTs_Runnable
+                && reqno != VG_USERREQ__PTHREAD_YIELD)
                continue; /* with this thread */
             else
                goto stage1;
@@ -3194,9 +3195,8 @@ void do_client_request ( ThreadId tid )
 
       case VG_USERREQ__PTHREAD_YIELD:
          do_pthread_yield ( tid );
-         /* because this is classified as a non-trivial client
-            request, the scheduler should now select a new thread to
-            run. */
+         /* On return from do_client_request(), the scheduler will
+            select a new thread to run. */
         break;
 
       case VG_USERREQ__SET_CANCELSTATE:
index 74af761290a7d6e37006158d803d30f0caec817f..6a99730bebf5c2b852f30b9550eb7a4dce8513bd 100644 (file)
@@ -1319,13 +1319,14 @@ VgSchedReturnCode VG_(scheduler) ( void )
          }
 
          if (trc == VG_TRC_EBP_JMP_CLIENTREQ) {
-            /* VG_(printf)("request 0x%x\n", 
-                           *(UInt*)(VG_(threads)[tid].m_eax)); */
+            UInt reqno = *(UInt*)(VG_(threads)[tid].m_eax);
+            /* VG_(printf)("request 0x%x\n", reqno); */
             do_client_request(tid);
             /* Following the request, we try and continue with the
                same thread if still runnable.  If not, go back to
                Stage 1 to select a new thread to run. */
-            if (VG_(threads)[tid].status == VgTs_Runnable)
+            if (VG_(threads)[tid].status == VgTs_Runnable
+                && reqno != VG_USERREQ__PTHREAD_YIELD)
                continue; /* with this thread */
             else
                goto stage1;
@@ -3194,9 +3195,8 @@ void do_client_request ( ThreadId tid )
 
       case VG_USERREQ__PTHREAD_YIELD:
          do_pthread_yield ( tid );
-         /* because this is classified as a non-trivial client
-            request, the scheduler should now select a new thread to
-            run. */
+         /* On return from do_client_request(), the scheduler will
+            select a new thread to run. */
         break;
 
       case VG_USERREQ__SET_CANCELSTATE: