Front page | perl.perl5.porters |
Postings from March 2000
[PATCH] Thread/*.pm
From:
Tom Christiansen
Date:
March 17, 2000 07:59
Subject:
[PATCH] Thread/*.pm
Message ID:
5758.953308770@chthon
This at least compiles now. It didn't before.
But I think that there's something wrong with Thread::Specific
the way it's mangling its %FIELDS array. Perhaps that's
why I never did get it working.
--tom
diff -bur /home/doriath/tchrist/bleadperl/lib/Thread/Queue.pm ./Queue.pm
--- /home/doriath/tchrist/bleadperl/lib/Thread/Queue.pm Mon Jan 24 12:56:01 2000
+++ ./Queue.pm Fri Mar 17 06:28:09 2000
@@ -67,13 +67,13 @@
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 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 -bur /home/doriath/tchrist/bleadperl/lib/Thread/Semaphore.pm ./Semaphore.pm
--- /home/doriath/tchrist/bleadperl/lib/Thread/Semaphore.pm Mon Jan 24 12:56:01 2000
+++ ./Semaphore.pm Fri Mar 17 06:28:37 2000
@@ -69,14 +69,14 @@
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 -bur /home/doriath/tchrist/bleadperl/lib/Thread/Specific.pm ./Specific.pm
--- /home/doriath/tchrist/bleadperl/lib/Thread/Specific.pm Mon Jan 24 12:56:01 2000
+++ ./Specific.pm Fri Mar 17 06:31:00 2000
@@ -15,12 +15,13 @@
=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__};
}
-
[PATCH] Thread/*.pm
by Tom Christiansen