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;
}
}
-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);
}
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;
=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__};
}