From: Jerry D. Hedden Date: Mon, 17 Jul 2006 05:00:01 +0000 (-0700) Subject: [Fwd: Smoke [5.9.4] 28575 FAIL(XF) OSF1 V5.1 (EV6/4 cpu)] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f782ee33d0f49cb1ee007e3e83d1f175efc6fdc1;p=p5sagit%2Fp5-mst-13.2.git [Fwd: Smoke [5.9.4] 28575 FAIL(XF) OSF1 V5.1 (EV6/4 cpu)] From: "Jerry D. Hedden" Message-ID: <20060717050001.fb30e530d17747c2b054d625b8945d88.b729fe881f.wbe@email.secureserver.net> p4raw-id: //depot/perl@28598 --- diff --git a/ext/threads/t/basic.t b/ext/threads/t/basic.t index 1501d77..7e7fecf 100755 --- a/ext/threads/t/basic.t +++ b/ext/threads/t/basic.t @@ -68,11 +68,11 @@ sub test4 { { my $thread1 = threads->create('test4'); $thread1->detach(); + while ($thread1->is_running()) { + threads->yield(); + sleep 1; + } } - -threads->yield; # help out non-preemptive thread implementations -sleep 2; - ok(7, 1, "Detach test"); diff --git a/ext/threads/t/free.t b/ext/threads/t/free.t index 0e8bd86..3dfc4a1 100644 --- a/ext/threads/t/free.t +++ b/ext/threads/t/free.t @@ -62,14 +62,17 @@ sub ok { # Tests freeing the Perl interperter for each thread # See http://www.nntp.perl.org/group/perl.perl5.porters/110772 for details -my $COUNT; -share($COUNT); +my ($COUNT, $STARTED) :shared; sub threading_1 { my $tid = threads->tid(); ok($tid, "Thread $tid started"); - if ($tid < 5) { + { + lock($STARTED); + $STARTED++; + } + if ($STARTED < 5) { sleep(1); threads->create('threading_1')->detach(); } @@ -95,12 +98,16 @@ sub threading_1 { } { + $STARTED = 0; $COUNT = 0; threads->create('threading_1')->detach(); { lock($COUNT); while ($COUNT < 3) { cond_wait($COUNT); + threads->create(sub { + threads->create(sub { })->join(); + })->join(); } } } @@ -109,6 +116,9 @@ sub threading_1 { lock($COUNT); while ($COUNT < 5) { cond_wait($COUNT); + threads->create(sub { + threads->create(sub { })->join(); + })->join(); } } threads->yield(); @@ -121,7 +131,11 @@ sub threading_2 { my $tid = threads->tid(); ok($tid, "Thread $tid started"); - if ($tid < 10) { + { + lock($STARTED); + $STARTED++; + } + if ($STARTED < 5) { threads->create('threading_2')->detach(); } @@ -135,11 +149,15 @@ sub threading_2 { } { + $STARTED = 0; $COUNT = 0; threads->create('threading_2')->detach(); + threads->create(sub { + threads->create(sub { })->join(); + })->join(); { lock($COUNT); - while ($COUNT < 3) { + while ($COUNT < 5) { cond_wait($COUNT); } }