From: Gurusamy Sarathy Date: Fri, 17 Mar 2000 16:48:20 +0000 (+0000) Subject: syntax errors in Thread::* (from Tom Christiansen) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2954239bd785bd1e3837b70fcb2957307430febf;p=p5sagit%2Fp5-mst-13.2.git syntax errors in Thread::* (from Tom Christiansen) p4raw-id: //depot/perl@5786 --- diff --git a/ext/Thread/Thread/Queue.pm b/ext/Thread/Thread/Queue.pm index 6e2fba8..831573c 100644 --- a/ext/Thread/Thread/Queue.pm +++ b/ext/Thread/Thread/Queue.pm @@ -67,13 +67,13 @@ sub new { return bless [@_], $class; } -sub dequeue : locked, method { +sub dequeue : locked : method { my $q = shift; cond_wait $q until @$q; return shift @$q; } -sub dequeue_nb : locked, method { +sub dequeue_nb : locked : method { my $q = shift; if (@$q) { return shift @$q; @@ -82,12 +82,12 @@ sub dequeue_nb : locked, method { } } -sub enqueue : locked, method { +sub enqueue : locked : method { my $q = shift; push(@$q, @_) and cond_broadcast $q; } -sub pending : locked, method { +sub pending : locked : method { my $q = shift; return scalar(@$q); } diff --git a/ext/Thread/Thread/Semaphore.pm b/ext/Thread/Thread/Semaphore.pm index f50f96c..3cd6338 100644 --- a/ext/Thread/Thread/Semaphore.pm +++ b/ext/Thread/Thread/Semaphore.pm @@ -69,14 +69,14 @@ sub new { bless \$val, $class; } -sub down : locked, method { +sub down : locked : method { my $s = shift; my $inc = @_ ? shift : 1; cond_wait $s until $$s >= $inc; $$s -= $inc; } -sub up : locked, method { +sub up : locked : method { my $s = shift; my $inc = @_ ? shift : 1; ($$s += $inc) > 0 and cond_broadcast $s; diff --git a/ext/Thread/Thread/Specific.pm b/ext/Thread/Thread/Specific.pm index da3f937..a6271a4 100644 --- a/ext/Thread/Thread/Specific.pm +++ b/ext/Thread/Thread/Specific.pm @@ -15,12 +15,13 @@ C returns a unique thread-specific key. =cut -sub import : locked, method { +sub import : locked : method { require fields; fields::->import(@_); } -sub key_create : locked, method { +sub key_create : locked : method { + our %FIELDS; # suppress "used only once" return ++$FIELDS{__MAX__}; }