From: Julian Seward Date: Fri, 12 Jul 2002 22:30:51 +0000 (+0000) Subject: Make VG_USERREQ__PTHREAD_YIELD actually yield the thread. This used X-Git-Tag: svn/VALGRIND_1_0_3~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5a8caf44ed59aefcc81e8841b24d6b6b4f91488;p=thirdparty%2Fvalgrind.git Make VG_USERREQ__PTHREAD_YIELD actually yield the thread. This used 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 --- diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 74af761290..6a99730beb 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -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: diff --git a/vg_scheduler.c b/vg_scheduler.c index 74af761290..6a99730beb 100644 --- a/vg_scheduler.c +++ b/vg_scheduler.c @@ -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: