Re: [PATCH threads] revised warnings + more tests + docs
Dave Mitchell [Sun, 19 May 2002 00:50:43 +0000 (01:50 +0100)]
Message-ID: <20020519005043.F7275@fdgroup.com>

p4raw-id: //depot/perl@16689

ext/threads/shared/t/cond.t

index 9601605..8c79347 100644 (file)
@@ -10,7 +10,7 @@ BEGIN {
     }
 }
 $|++;
-print "1..25\n";
+print "1..29\n";
 use strict;
 
 
@@ -247,3 +247,26 @@ sub ok {
 
 }
 
+# test warnings;
+
+{
+    my $warncount = 0;
+    local $SIG{__WARN__} = sub { $warncount++ };
+
+    my $lock : shared;
+
+    cond_signal($lock);
+    ok(1, $warncount == 1, 'get warning on cond_signal');
+    cond_broadcast($lock);
+    ok(2, $warncount == 2, 'get warning on cond_broadcast');
+    no warnings 'threads';
+    cond_signal($lock);
+    ok(3, $warncount == 2, 'get no warning on cond_signal');
+    cond_broadcast($lock);
+    ok(4, $warncount == 2, 'get no warning on cond_broadcast');
+
+    $Base += 4;
+}
+
+
+