diff options
author | Jerry D. Hedden <jdhedden@cpan.org> | 2006-07-16 22:00:01 -0700 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-07-18 21:02:39 +0000 |
commit | f782ee33d0f49cb1ee007e3e83d1f175efc6fdc1 (patch) | |
tree | 1d8b4c8f2ea0641ef9a2c991918bfa08ebccf55c | |
parent | 3b91ae7afdaa3c016fc392dcbebaa10c1e7c4bb1 (diff) | |
download | perl-f782ee33d0f49cb1ee007e3e83d1f175efc6fdc1.tar.gz |
[Fwd: Smoke [5.9.4] 28575 FAIL(XF) OSF1 V5.1 (EV6/4 cpu)]
From: "Jerry D. Hedden" <jerry@hedden.us>
Message-ID: <20060717050001.fb30e530d17747c2b054d625b8945d88.b729fe881f.wbe@email.secureserver.net>
p4raw-id: //depot/perl@28598
-rwxr-xr-x | ext/threads/t/basic.t | 8 | ||||
-rw-r--r-- | ext/threads/t/free.t | 28 |
2 files changed, 27 insertions, 9 deletions
diff --git a/ext/threads/t/basic.t b/ext/threads/t/basic.t index 1501d77fe0..7e7fecffe7 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 0e8bd86cd1..3dfc4a12b8 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); } } |