From: Julian Seward Date: Sun, 18 Nov 2007 01:16:52 +0000 (+0000) Subject: Try to fix, or at least avoid if possible, some arbitrary delays at X-Git-Tag: svn/VALGRIND_3_3_0~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4ab41b54bcceadc14a2e75c20bf5b198cbe25ed;p=thirdparty%2Fvalgrind.git Try to fix, or at least avoid if possible, some arbitrary delays at thread creation time observed when running on POWER5 64-bit Linux. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7179 --- diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 6a0baba66b..14a0fc63e0 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -216,8 +216,13 @@ PTH_FUNC(int, pthreadZucreateZAZa, // pthread_create@* /* we have to wait for the child to notify the tool of its pthread_t before continuing */ while (xargs[2] != 0) { - // FIXME: add a yield client request - /* do nothing */ + /* Do nothing. We need to spin until the child writes to + xargs[2]. However, that can lead to starvation in the + child and very long delays (eg, tc19_shadowmem on + ppc64-linux Fedora Core 6). So yield the cpu if we can, + to let the child run at the earliest available + opportunity. */ + sched_yield(); } } else { DO_PthAPIerror( "pthread_create", ret );