[Fwd: Smoke [5.9.4] 28575 FAIL(XF) OSF1 V5.1 (EV6/4 cpu)]
Jerry D. Hedden [Mon, 17 Jul 2006 05:00:01 +0000 (22:00 -0700)]
From: "Jerry D. Hedden" <jerry@hedden.us>
Message-ID: <20060717050001.fb30e530d17747c2b054d625b8945d88.b729fe881f.wbe@email.secureserver.net>

p4raw-id: //depot/perl@28598

ext/threads/t/basic.t
ext/threads/t/free.t

index 1501d77..7e7fecf 100755 (executable)
@@ -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");
 
 
index 0e8bd86..3dfc4a1 100644 (file)
@@ -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);
         }
     }